1
$\begingroup$

There are some rendering options (for example, Lighting) which are associated with the Graphics3D objects. I cannot apply these options for an Image3D object (for example, ExampleData[{"TestImage3D", "MRknee"}]).

Is there any way to convert an Image3D object into Graphics3D object, apply some lighting options and convert back to Image3D object?

$\endgroup$
  • 1
    $\begingroup$ Graphics is vector graphics containing geometric primitives. Image is simply a raster--a grid of pixels. You cannot, in general, recover geometric figures merely from their representation on a grid. $\endgroup$ – Oleksandr R. Apr 28 '16 at 15:58
  • $\begingroup$ This is closely related to mathematica.stackexchange.com/questions/91998/… $\endgroup$ – M.R. Apr 28 '16 at 20:15
1
$\begingroup$

Simply use Show. This creates a Graphics3D containing a Raster3D.

In general, expressions convertible to Graphics are converted with Show. This works for images, 3D images, graphs, and possibly other things I've forgotten about.

But I'm not sure Lighting is ever used in the rendering of 3D images, regardless of whether they are contained in an Image3D or a Graphics3D through Raster3D ...

As for the reverse conversion, that is not possible for arbitrary Graphics3D. But you can always extract a Raster3D and transplant its contents into an Image3D.

For 2D images, just use Image[Graphics[...]].

$\endgroup$
  • $\begingroup$ Note that "Image[Raster[...]] converts a Raster object to an image" and "Image3D[Raster3D[...]] converts a Raster3D object to a 3D image" (from the "Details and Options" fields of Image and Image3D Documentaion pages). As opposed to this, Image[Graphics[...]] uses Rasterize under the hood. $\endgroup$ – Alexey Popkov Apr 28 '16 at 16:17
0
$\begingroup$

For Graphics3D -> Image3D:

This answer: https://mathematica.stackexchange.com/a/33277/6804 gives an approach that rasterizes individual 2D slices at different heights and stacks them into a 3d image.

Of course you need to select a resolution, the conversion will not be lossless in general (and I don't know what would happen when the Graphics3D object is a Show@Image3D... maybe you get a resampling, or nothing).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.