[ITK] [ITK-users] Merging segmentation masks in different region of interests

Alberto Bert bert.alberto at gmail.com
Tue Jan 26 09:21:31 EST 2016


Thanks Tim,

according to the documentation, RegionOfInterestImageFilter should do what you say, that is why I tried to used it. Unfortunately, it seems not to keep the original logical references...

I am not sure I can efficiently do what you suggest with SimpleITK, but if it turns out to be the only way, I guess I will need to switch to the original ITK. I hoped there was a way to do it without a pixel by pixel copy…

Any other suggestions?

Thanks!
Alberto

> On 26 Jan 2016, at 11:31, Timothee Evain <tevain at telecom-paristech.fr> wrote:
> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160126/cb2a3609/attachment-0001.html>
-------------- next part --------------
_____________________________________
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