In this post we will look at how you can extract 2D images from a medical image using only grasshopper.
What is the "Extent"?
The Get Extent component returns the extents of the image in the X, Y and Z direction. But what exactly does that mean? Very simple. The extents simply define the valid indeces in each of the three dimensions, or in other words the size of the 3D image in pixels.
Use the Extract Slice component to get a single 2D slice. The inputs are the following:
- Rhino3DMedical Image
This image comes either from the reader or from an image filter
- Plane identifier
This has to be an integer between 0 and 2. 0 extracts an axial or XY slice, 1 a coronal or XZ slice, and 2 a sagittal or YZ slice.
- The slice number you wish to extract
This number should be within the bounds defined by the extents, but if it isn’t the closest existing slice will be displayed instead.
The easiest way to create the sliders is to type "
0<1<2" this will create a slider with current value 1 that goes from 0 to 2.
These slices can be combined with the existing methods for creating surfaces.