[ITK] [ITK-users] Merging segmentation masks in different region of interests
Timothee Evain
tevain at telecom-paristech.fr
Tue Jan 26 05:31:21 EST 2016
Hello Alberto,
If I remember well, the RegionOfInterestImageFilter keeps the subparts in the same physical space, i.e. a same index will get you the same pixel/voxel in the ROI as in the original. So I would use an iterator to create your full mask image. Something like :
itk::Image<Type,Dim>::Pointer FullMask=itk::Image<Type,Dim>::New();
FullMask->SetRegions(OriginalImage->GetLargestPossibleRegion());
FullMask->Allocate();
itk::ImageRegionIteratorWithIndex<itk::Image<Type,Dim>> Iter(FullMask,FullMask->GetLargestPossibleRegion());
Iter.GoToBegin();
while(!Iter.IsAtEnd())
{
itk::Index<Dim> CurrentPoint=Iter.GetIndex();
if(//There you test the index to know from which subimage it belong//)
{
Iter.Set(SubImage->GetPixel(CurrentPoint));
}
++Iter;
}
HTH,
Tim
----- Mail original -----
De: "Alberto Bert" <bert.alberto at gmail.com>
À: "ITK Users" <insight-users at itk.org>
Envoyé: Mardi 26 Janvier 2016 11:07:49
Objet: [ITK] [ITK-users] Merging segmentation masks in different region of interests
Hi,
I have several rectangular regions of interest from a single image (extracted using RegionOfInterestImageFilter), and I am processing one at a time to extract from each of them a segmentation masks (image of labels with 0 or 1). Finally, I would need to “merge” (i.e. “combine” or “and”) the various ROI masks (different size and origin) in a single mask having the same size and origin of the original image. Let’s say I would need to “put back in the right place” the ROI masks.
The AndImageFilter does not allow me to combine the various ROI masks ("Inputs do not occupy the same physical space!”). I browsed the documentation but I could not find a viable solution...
I am currently using SimpleITK.
Can you help me please?
Thanks a lot!
Best
Alberto
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
_______________________________________________
Community mailing list
Community at itk.org
http://public.kitware.com/mailman/listinfo/community
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list