I need some help in exporting segmentations in a way that matches the original data. I searched the forum here and I solved part of the issue, but I can’t move forward.
I have a sequence of DICOM files, each one containing a 512x512 slice of a cardiac CT scan. A segmentation was made from these files with 3DSlicer, resulting in two files, nifti + nrrd. I can visualize everything and it looks good.
Now I’m doing some data analysis and I need the segmentation as a sequence of slices matching the original ones in size, number and z position - what I will do is comparing 2D arrays.
Size (512x512) is not a big problem, I can either add pixels or save DICOM files with the proper size by setting the original volume as reference. The number of slices can also be fixed by adding empty segmentation slices at the beginning and at the end of the sequence.
But alignment along the Z axis seems to be a problem. When I export the segmentation as DICOM and check the Z information, Z spacing is something like 0.39 instead of 0.4 of the original sequence… as a result I can’t add a simple offset to align the two sequences, because I always have misalignments at the beginning or at the end of the sequence.
It looks like my export does not preserve all the properties of the original sequence/volume… what am I understanding or doing wrong? Any help would be highly appreciated!
I can also provide examples if needed…