I used reformat module to fix an arbitrary plane using a normal vector and then visualized the slices by moving the plane on that normal. However, I am not able to extract all the slices from the defined plane and Reformat module only helps me in visualization of the intensities on those slices. Basically I would like to extract the slices containing the MRI intensities and store it in a 3D array for further processing. Please let me know how to solve this in 3D Slicer. Thanks
H @nish91 - there isn’t a built-in operation for this, but it can be done with a little programming and linear algebra. The Reformat operation changes the SliceToRAS matrix of the vtkMRMLSliceNode (this documentation should help. Then the information can be converted into a linear transform (maybe some modification needed) and then the volume can be resampled through the transform. You can then access the result volume as a numpy array.
Another option could be to use the ScreenCapture to get s movie of the slice viewer but you’d lose the geometry information.
You can also follow this example to get resliced image as a volume node and access it as a numpy array:
Thanks @lassoan for your reply, This works for me. I would like to save this array out of 3D Slicer so that I can access the voxel in other environments. Do you know which command will do that in python interactor??
Thanks for the reply. I will try this solution too.
How you are going to use the image? In what software, what programming language/environment? What format do you usually use for storing images?
I am going to use the voxel array in Jupyter notebook and I don’t have Slicer installed in my notebook. Therefore my best bet is to extract these images out of python interactor in 3D Slicer. I will use these images to feed into a neural network. I prefer any format (such as TIFF etc) which preserves the gray scale intensities.
Thanks for the details. To preserve all information, I would recommend to save in .nrrd format using
Thanks a lot. This works for me
I am trying to achieve something similar, and the solution you recommended works fine for re-slicing images in a reformatted way, but is there a way to reformat and get voxel values for a whole volume?
I saw that Steve Pieper mentioned that there is no built-in operation and a transformation might need to be created. Please let me know!