I’m having a spot of trouble with a DICOM volume. I used the resample module to change its spacing, but now I’m trying to place the origin of the whole volume so all the coordinates are positive.
I’m currently trying to use the reformat module < https://www.slicer.org/wiki/Documentation/4.0/Modules/Reformat > to change the origin, but the documentation says I can only do that slice by slice. So do I have to change every slice manually? Or is there a way to effect the change on the volume all at once?
I need to generate landmarks for another bit of code I’m working with, and it’s throwing some strange errors about spacing when I use negative landmarks (I’ve already converting the volume to isotropic spacing, so it’s not that). And I’m not sure if transforms is the right thing to use- not that I don’t trust your judgement. I’d just like to shift the coordinate system, not move the volume around within it. Can I do that with the transforms module?
Maybe what you need is landmark coordinates in voxel space (IJK) and you are wondering how to get that from landmark coordinates in physical (RAS) space?
Quick side question- If I have a landmark file in one set of coordinates, does slicer support converting it to another coordinate system, or will I have to go through the registration process?
You can easily convert between coordinates defined in any coordinate system, but of course you need to know the transformation between these coordinate systems.
You can read the volumeNode as a SimpleITK image object (image = sitkUtils.GetSlicerITKReadWriteAddress(<volumeNodeName>), after which you can access the transformation matrix by calling GetDirection() on the image object.
Alternatively, you can use image.TransformContinuousIndexToPhysicalPoint(<INDEX>) and TransformPhysicalPointToContinuousIndex(<POINT>) to calculate coordinates in the different coordinate systems.