[Insight-users] GetPixel() in LabelMap images.
Sergio Vera
sergio.vera at alma3d.com
Mon Jun 25 06:01:37 EDT 2012
Hello all
As stupid as it seems, it was my fault of using seeds defined in a program
that uses 1-based indexing while itk uses 0-based indexing.
It is working properly now :$
Thanks, Sergio
On Fri, Jun 22, 2012 at 12:32 AM, Cagatay Bilgin <bilgincc at gmail.com> wrote:
> Hi Sergio,
>
> I don't see any problems with the code you
> attached. What you are observing might be
> due to code you have not attached. Are you
> making sure to call update on the filter that
> gives you the label map prior to this piece of
> code? That would be my
> first guess. My second guess would be that
> the foreground/background values you use
> in your binaryimagetolabelmap filter might be
> set incorrectly resulting in an empty labelmap.
>
> In any case, it is always a good idea to attach
> minimal code that compiles and illustrates the
> problem with the input image you use.
>
> Let us know,
> Cagatay
>
> On Thu, Jun 21, 2012 at 9:51 AM, Sergio Vera <sergio.vera at alma3d.com>wrote:
>
>> Hello all!
>>
>> I have a LabelMap Image and I want to remove all labels except the ones
>> that have a seed.
>>
>> Sadly,
>>
>> std::vector<size_t> selectedLabels;
>> BOOST_FOREACH(const ITKImgInType::IndexType& seed, d_seeds) {
>> ITKImgInType::PixelType value = labelMap->GetPixel(seed);
>> if (value != 0) {
>> selectedLabels.push_back(value);
>> d_os << "Label " << value << " has been selected as a valid label.\n";
>> } else {
>> d_os << "0 found on " << seed << " :( \n";
>> }
>> }
>>
>> always return a zero value, even if there should be a correct label in
>> that seed position (I've checked that on the binary image that generated
>> the LabelMap). The label map has over 1000 LabelObjects
>>
>> Theoretically LabelImages support the GetPixel() Method (even if it's
>> slower).
>>
>> Any ideas on why this may be happening? I'm using itk 3.20.0 on windows.
>>
>> Thanks in advance
>>
>> --
>> Sergio Vera
>>
>> Alma IT Systems
>> C/ Vilana, 4B, 4º 1ª
>> 08022 Barcelona
>> T. (+34) 932 380 592
>> www.alma3d.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://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
--
Sergio Vera
Alma IT Systems
C/ Vilana, 4B, 4º 1ª
08022 Barcelona
T. (+34) 932 380 592
www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120625/87bff373/attachment.htm>
More information about the Insight-users
mailing list