Also, does anyone know if there is an easy way to figure out slice/voxel planes from the positions you desire in 3d slicer? What I mean is, if I want to know a particular slice number given the transverse (red) position in mm’s out of all the volume slices in a faster method than calculating it, is there one? Same with the sagittal and coronal planes to figure out the dimensions for a potential bounding box for an automated segmentation pipeline?

“Computation” of IJK (voxel coordinates) from RAS or LPS (physical coordinates) is multiplication of the coordinates by a 4x4 matrix, so it cannot really be any simpler than that. The matrix you need is the RAS to IJK matrix, available in the volume node.

The listed IJK to RAS direction matrix in the volumes module is only a 3x3 matrix (-1, 0, 0; 0, -1, 0;0, 0, 1). How do I get the 4x4 matrix then?

Also, ultimately what I am trying to do is figure out the file number from the volume of files that starts and ends my boudning box, then the planes for the sides with the voxels. This will work that out for me?

My bounding box is going to be hard-coded values for the dimensions to automatically generate the bounding box in all of my CT volumes, but I’m not sure how to do that in slicer so I am trying to do it in MATLAB, but I need to know the dimension from the volume of files?

There’s a bunch of utility functions to convert positions between world, image, and slice positions:

Are these codes that I would input? I’ve never done any python coding so I’m not sure?

Getting the DICOM file number from physical coordinates is much more complicated than getting IJK coordinates from a volume file. Doing all this in Matlab sounds even worse.

Fortunately, you can easily crop the volume in Slicer by creating a small Python script that creates a region of interest (ROI) node and uses the Crop volume module to crop the input volume using that ROI node. You can get started by completing the Slicer4 programming tutorial then create a new module that does the cropping you need. If you are stuck at any point then post your question and a link to the source code of your module on GitHub and we’ll help you.