[ITK] [ITK-users] ImageI iterators same walk order simultaneously
Timothee Evain
tevain at telecom-paristech.fr
Mon Jun 20 04:41:42 EDT 2016
Hi Javier,
You can use iterators to do so without problems, given that you ensure that:
- The two images are in the same reference frame (i.e. axes represent the same directions in both).
- The ImageRegions to parse are identical .
Otherwise you will lose the correpondence between the images.
HTH,
Tim
----- Mail original -----
De: "Javier Juan Albarracín" <javij1 at gmail.com>
À: insight-users at itk.org
Envoyé: Dimanche 19 Juin 2016 01:59:34
Objet: [ITK] [ITK-users] ImageI iterators same walk order simultaneously
Hello,
I want to traverse an image that points to an intra-cranial mask, and
perform an operation on other image only in the voxels where the
intra-cranial mask are true. I wrote the following code:
itk::ImageRegionConstIterator<MaskType> iteratorMask(mask,
mask->GetLargestPossibleRegion());
itk::ImageRegionIterator<MapType> iteratorMap(map,
map->GetLargestPossibleRegion());
iteratorMask.GoToBegin();
iteratorMap.GoToBegin();
while (!iteratorMask.IsAtEnd())
{
if (iteratorMask.Get())
{
iteratorMap.Set(i);
++i;
}
++iteratorMask;
++iteratorMap;
}
My question is: can I be sure that, with this implementation both
iterators point to the same voxel of the image simultaneously? Or should
I use itk::ImageRegionConstIteratorWithIndex on "mask" and modify "map"
through the "SetPixel" method? I have read that "SetPixel" and
"GetPixel" methods are slow and not preferred against iterators. It is
possible to implement this operation only with iterators?
Thank you very much
Regards.
Javier.
_____________________________________
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