[ITK] [ITK-users] Counting the number of pixels with specific color
Timothee Evain
tevain at telecom-paristech.fr
Fri Apr 15 16:11:50 EDT 2016
Hello,
One simple way to do it is to use an iterator and count voxels.
You could use something like:
itk::ImageRegionConstIterator<ImageType> MyIt(MyImage,MyImage->GetLargestPossibleRegion());
MyIt.GoToBegin();
int Volume=0;
while (!MyIt.IsAtEnd())
{
if (MyIt.Get()==255) //Or whatever value is your white pixel
{
Volume+=1;
}
++MyIt;
}
You could also use the LabelMap workflow to detect volume of different labels.
HTH,
Tim
----- Mail original -----
De: "karolkc" <karolkc at gmail.com>
À: insight-users at itk.org
Envoyé: Vendredi 15 Avril 2016 19:37:47
Objet: [ITK] [ITK-users] Counting the number of pixels with specific color
Hello,
I would like to ask if there is a function in ITK that could count the
number of pixels with specific color.
I have already used Region Growing filter for segmentation, then I created
an image containing white pixels on black background presenting my segmented
region.
Now I'd like to calculate the volume of this region. The simplest way is
just to calculate the number of white pixels. But how?
Do you have any ideas or suggestions?
Best Regards!
--
View this message in context: http://itk-users.7.n7.nabble.com/Counting-the-number-of-pixels-with-specific-color-tp37028.html
Sent from the ITK - Users mailing list archive at Nabble.com.
_____________________________________
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