[Insight-users] itk::ChangeLabelImageFilter

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Mon Jun 12 07:52:09 EDT 2006


On Fri, 09 Jun 2006 11:23:34 +0200, Henning Meyer <tutmann at gmail.com>  
wrote:

> Maybe thats not needed. I think ChangeLabelImageFilter is ok.
> I created my ChangeMap by trying to loop over all labels
> LabelStatisticsImageFilter returned.
> But I did it wrong.
>
> Confusing thing is, there is a
> LabelStatisticsImageFilter::GetNumberOfObjects and
> LabelStatisticsImageFilter::GetNumberOfLabels - both seem to do the
> same.
> But there is no way of finding out, what the actual labels are.
> So I have to use MinimumMaximumImageCalculator::GetMinimum() and
> GetMaximum() to get the range to iterate, which might be very stupid
> (labelPixels are long int - so there can be a huge range).
>

I agree with you. LabelStatisticsImageFilter should be able to return a  
list of available labels - not only the numbers of labels.

The simplest way to take care of that is to relabel the image with  
RelabelComponentImageFilter. After that filters, all the labels are  
between 1 and N, where N is the number of labels.

Gaetan

> Henning
>
>
> 2006/6/8, Miller, James V (GE, Research) <millerjv at crd.ge.com>:
>>
>> I think Dirk Padfield or Tim Kelliher wrote the  
>> ChangeLabelImageFilter.  I'll have one them take
>> a look at the SetChangeMap() issue.
>>
>> Jim
>>
>> -----Original Message-----
>> From: insight-users-bounces+millerjv=crd.ge.com at itk.org
>> [mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
>> Henning Meyer
>> Sent: Wednesday, June 07, 2006 10:15 AM
>> To: Gaetan Lehmann
>> Cc: insight-users at itk.org
>> Subject: Re: [Insight-users] itk::ChangeLabelImageFilter
>>
>>
>> I see. But what do I do wrong:
>>
>> This works:
>>
>>         ChangeLabelFilterType::ChangeMapType changeMap;
>> // some code to set the map
>>         LabeledImageIteratorType watershedIt( watershedImage,
>> watershedImage->GetBufferedRegion() );
>>         for(watershedIt.GoToBegin(); !watershedIt.IsAtEnd();  
>> ++watershedIt)
>>                 watershedIt.Set( changeMap[ watershedIt.Get() ] );
>>
>> But this does not:
>>         ChangeLabelFilterType::Pointer labelChanger =  
>> ChangeLabelFilterType::New();
>>         labelChanger->SetInput( watershedImage );
>>         labelChanger->SetChangeMap( changeMap );
>>         labelChanger->Update();
>>         LabeledImageType::Pointer labelChangedImage =  
>> labelChanger->GetOutput();
>>
>> Thanks for your help!
>>
>> Henning
>>
>>
>> 2006/6/7, Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr>:
>> >
>> > Hi,
>> >
>> > The ChangeLabelImageFilter works without problem (for me).
>> > Most of the code is in the functor declared in the header: this  
>> filter use
>> > the UnaryFunctorImageFilter to simplify its implementation.
>> >
>> > Gaetan
>> >
>> >
>> > On Wed, 07 Jun 2006 15:36:52 +0200, Henning Meyer <tutmann at gmail.com>
>> > wrote:
>> >
>> > > Hello,
>> > >
>> > > maybe a stupid question:
>> > > Does itk::ChangeLabelImageFilter (ITK 2.6) do anything usefull at  
>> all?
>> > > The source just looks like an empty template generated filter.
>> > >
>> > > Did I do something wrong?
>> > >
>> > > Thanks for your help!
>> > >
>> > > Henning
>> > > _______________________________________________
>> > > Insight-users mailing list
>> > > Insight-users at itk.org
>> > > http://www.itk.org/mailman/listinfo/insight-users
>> >
>> >
>> >
>> > --
>> > Gaëtan Lehmann
>> > Biologie du Développement et de la Reproduction
>> > INRA de Jouy-en-Josas (France)
>> > tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>> > http://voxel.jouy.inra.fr
>> >
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-users mailing list