Hi everyone!
I would like to get a segment from a segmentation node as a vtkImageData (not a vtkOrientedImageData).
My pipeline is:
- I create a segment from a binary vtkImageData
- Then I modify this segment in the segment editor
- I want to get back that segment after these modifications in the vtkImageData I had before (in step 1)
- To check, I create a new segment from the vtkImageData with the modifications done (got from step 3)
I am currently doing this:
std::string segmentID = “…”;
vtkOrientedImageData* labelmap = segmentationNode->GetBinaryLabelmapRepresentation(segmentID);
vtkImageData* image;
image->DeepCopy(labelmap);
My problem is that the vtkImageData (“image”) I get back has a spacing and an origin not set to 0 (I was told that for a vtkImageData it has to be 0) and that if I create a new segment from that image the two segmentations don’t match, meaning the shape is the same but the location is not, see: the blue segment is the one I have in Slicer after using tools in the segment editor and the yellow one is the one created from the vtkImageData I get back (I want them to be the same)
I’m not sure how to deal with this location problem
Thanks for your help,
Marine.