Thanks @lassoan.
I could figure it out the problem and could align the volume with segmentation label map using the following piece of code (I know centering the volume in this way is not recommended but since I am just exporting the label maps to NRRD for my segmentation task, and it solved my issue):
# Center volume
if center_volume:
volumesLogic = slicer.modules.volumes.logic()
volumesLogic.CenterVolume(volumeNode)
I explored my multi-frames DICOM images and I noticed that I am working with raw data. It means the DICOM header does not have the PixelSpacing tag, but that information stored in metadata as a private tag. When I load the images into the 3D Slicer, it automatically map the volume to a pixel spacing of [1.0 , 1.0, 1.0] mm and origin of [0.0, 0.0, 0.0].
I was wondering if there is any way, that we can tell the Slicer to pick the Pixel-Spacing from the private tag when we load the data? I tried to resample the data but it was not a practical approach.
-
I realized, what if I add a new tag to DICOM headers of my RAW DICOMS as “PixelSpacing” and copy the information from private tag and store it as a new DICOM file, would it load on 3D Slicer correctly? I am not sure.
(1129, 1004) Private tag data IS: [67, 3899, 2884, -4096]
(1129, 1005) Private tag data IS: [67, 3899, 543, -4096]
(1129, 1008) Private tag data DS: “0.0”
(1129, 1015) Private tag data IS: “4096”
(1129, 1016) Private tag data DS: [0.24960000813007, 0.24960000813007, 0.24960000813007]
(1129, 1017) Private tag data DS: “4.0”
(1129, 1023) Private tag data IS: “4”
Best.