[Insight-users] Possible bug in Label Overlay Filter (Ga?tan Lehmann)

Maria Alejandra Zuluaga Valencia mariazulv at yahoo.es
Mon Apr 4 17:02:51 EDT 2011


Hi,
I managed to find the problem on my code involving LabelOverlayFiltering and was 
related to an other third party IO class that wrote to disc the resulting image.

However, I wanted to comment on this to avoid future misunderstanding. One of my 
doubts raised from the fact that the filter seems to add transparency and it 
still the resulting image is RGB and not RGBA. After discussing with the filter 
author (thanks alot for your help), this is the answer on that issue:

The transparency is only for the overlay layer. The produced image is still 100% 
opaque.

Maria



________________________________
De: "insight-users-request at itk.org" <insight-users-request at itk.org>
Para: insight-users at itk.org
Enviado: mié,30 marzo, 2011 18:00
Asunto: Insight-users Digest, Vol 83, Issue 56

Send Insight-users mailing list submissions to
    insight-users at itk.org

To subscribe or unsubscribe via the World Wide Web, visit
    http://www.itk.org/mailman/listinfo/insight-users
or, via email, send a message with subject or body 'help' to
    insight-users-request at itk.org

You can reach the person managing the list at
    insight-users-owner at itk.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Insight-users digest..."


Today's Topics:

   1. Re: LabelShapeOpeningImageFilter Attribute input =?
      (Richard Beare)
   2. Re: LabelShapeOpeningImageFilter Attribute input
      (Ella Maria Kadas)
   3. Re: Possible bug in Label Overlay Filter (Ga?tan Lehmann)
   4. Re: LabelShapeOpeningImageFilter Attribute input (Ga?tan Lehmann)


----------------------------------------------------------------------

Message: 1
Date: Wed, 30 Mar 2011 23:03:14 +1100
From: Richard Beare <richard.beare at gmail.com>
Subject: Re: [Insight-users] LabelShapeOpeningImageFilter Attribute
    input =?
To: Ella Maria Kadas <ella_kadas at yahoo.com>
Cc: "insight-users at itk.org" <insight-users at itk.org>
Message-ID:
    <AANLkTi=WeCa3nrZ1B0U2QP54Lsme3gryouXpe_g8EF6g at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

There is a convenience class in the Review directory that is derived from
this contribution called itk::BinaryShapeOpeningImageFilter. This includes
all of the labelling and conversion to and from label maps. You just need to
call the SetAttribute and SetForegroundValue appropriately. It should work
fine for 3D. If you look inside that class you should also find the standard
combination of steps you need to go through to use the LabelMap filters.

On Wed, Mar 30, 2011 at 9:09 PM, Ella Maria Kadas <ella_kadas at yahoo.com>wrote:

> Hi all,
>
>     I am trying to remove some objects from a 3D image that have a volume
> lower then a specific value.
>    I tried to use the Label object representation and manipulation with
> ITK that Gae ?tan Lehmann
> implemented but i still don't know what that attribute parameter should
> look like. (in the python example it looks a s it would be a char
> size =
> itk.ShapeOpeningLabelMapFilter[LabelMapType].New(stats,Attribute=?Size?,
> Lambda=100)
>  I want to use the ShapeLabelObject, and it's attributes to do a
> LabelShapeOpeningFilter.
>  As i was getting no result i tried to do it in 2D first.
>  This is my code:
> First i use the ConnectedComponentImageFilter, then
> RelabelComponentImageFilter and create a ShapeLabelMap from the relabel's
> output.
>
> typedef unsigned long LabelType;
>
>   typedef itk::ShapeLabelObject< LabelType, dim > LabelObjectType;
>
>   typedef itk::LabelMap< LabelObjectType > LabelMapType;
>
>
>
>   typedef itk::LabelImageToShapeLabelMapFilter< LabelImageType,
> LabelMapType > ConverterType;
>
>   ConverterType::Pointer converter = ConverterType::New();
>
>   converter->SetInput( relabel->GetOutput() );
>
>   converter->Update();
>
> !!!! Why does it not work if i use this part of code from the journal
>
> /*
>
> and valuate the attributes with the dedicated filter: ShapeLabelMapFilter
>
> typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType;
> ShapeFilterType::Pointer shape = ShapeFilterType::New(); shape->SetInput(
> converter->GetOutput() );
>
> update the shape filter, so its output will be up to date
>
> shape->Update();
>
> */
>
>
>   LabelMapType::Pointer labelMap = converter->GetOutput();
>
> std::cout<<"nr of label
> objects"<<labelMap->GetNumberOfLabelObjects()<<std::endl;
>
>
>   for( unsigned int label=1; label<=labelMap->GetNumberOfLabelObjects();
> label++ )
>
>     {
>
>
>
>     const LabelObjectType * labelObject = labelMap->GetLabelObject( label
> );
>
>     std::cout << label << "\t" << labelObject->GetPhysicalSize() << "\t" <<
> labelObject->GetCentroid() << std::endl;
>
>     }
>
>
>  typedef itk::LabelShapeOpeningImageFilter< LabelImageType >
> LabelOpeningType;
>
> LabelOpeningType::Pointer opening = LabelOpeningType::New();
>
> opening->SetInput( relabel->GetOutput());
>
> opening->SetBackgroundValue(0);
>
> opening->SetLambda( 100 );
>
> opening->SetReverseOrdering( false );
>
> //NO IDEA About the Attribute
>
> //I thought it should be the labelMap->Size()) should be as attribute
>
> opening->SetAttribute("PERIMETER");
>
> itk::SimpleFilterWatcher watcher(opening, "filter");
>
> Then i would like to get back the binary image and see it but i can't get
> the proper image types as input to LabelMapToLabelIamgeFilter....So the
> commented part is not working
>
>
>  /*typedef itk::LabelMapToLabelImageFilter< LabelImageType, LabelImageType
> > L2IType;
>
> L2IType::Pointer l2i = L2IType::New();
>
> l2i->SetInput( opening->GetOutput() );
>
>  typedef itk::ImageFileWriter< LabelImageType > WriterType;
>
> WriterType::Pointer writer = WriterType::New();
>
> writer->SetInput( l2i->GetOutput() );
>
> writer->SetFileName( "/Users/ellaK/Documents/Morphology/Opening.gipl");
>
> writer->Update();*/
>
> std::getchar();
>
>
>
> Maybe i am doing this the wrong way, and i can't use it for 3D images.
> If anybody already already worked with this filters please give me a hint
> to what i am doing wrong.
> Thanks,
>    Ella
>
> _____________________________________
> 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.html
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.itk.org/pipermail/insight-users/attachments/20110330/26682abb/attachment-0001.htm>


------------------------------

Message: 2
Date: Wed, 30 Mar 2011 13:51:23 +0100 (BST)
From: Ella Maria Kadas <ella_kadas at yahoo.com>
Subject: Re: [Insight-users] LabelShapeOpeningImageFilter Attribute
    input
To: Richard.Beare at ieee.org
Cc: "insight-users at itk.org" <insight-users at itk.org>
Message-ID: <259184.90324.qm at web29617.mail.ird.yahoo.com>
Content-Type: text/plain; charset="utf-8"

Hi,
?Yes i already tried that and in the by default the Attribute value is "Size", 
which as far as i understood is the Perimeter of the shape that has a specific 
label (length-coding)-don't know how that applies to 3D images, but trying to 
apply the itkBinaryShapeOpeningImageFilter i get the following error (my input 
image is a float one).Start BinaryShapeOpeningImageFilter "filter" 
BinaryShapeOpeningImageFilter (0x402d160)
? RTTI typeinfo: ? itk::BinaryShapeOpeningImageFilter<itk::Image<float, 3u> >
? Reference Count: 3
? Modified Time: 1082
? Debug: Off
? Observers:?
? ? StartEvent(SimpleMemberCommand)
? ? EndEvent(SimpleMemberCommand)
? ? ProgressEvent(SimpleMemberCommand)
? ? IterationEvent(SimpleMemberCommand)
? ? AbortEvent(SimpleMemberCommand)
? Number Of Required Inputs: 1
? Number Of Required Outputs: 1
? Number Of Threads: 8
? ReleaseDataFlag: Off
? ReleaseDataBeforeUpdateFlag: Off
? Input 0: (0x402cde0)
? Output 0: (0x402d380)
? AbortGenerateData: Off
? Progress: 0
? Multithreader:?
? ? RTTI typeinfo: ? itk::MultiThreader
? ? Reference Count: 1
? ? Modified Time: 1069
? ? Debug: Off
? ? Observers:?
? ? ? none
? ? Thread Count: 8
? ? Global Maximum Number Of Threads: 128
? ? Global Default Number Of Threads: 8
? FullyConnected: 0
? BackgroundValue: 0
? ForegroundValue: 255
? Lambda: 500
? ReverseOrdering: 0
? Attribute: Size (0)
Progress? | 0 | 0.00292969 | 0.00585938 | 0.00878906 | 0.0117188 | 0.0146484 | 
0.0175781 | 0.0205078 | 0.0234375 | 0.0263672
?| 0.0292969 | 0.0322266 | 0.0351562 | 0.0380859 | 0.0410156 | 0.0439453 | 
0.046875 | 0.0498047 | 0.0527344 | 0.0556641
?| 0.0585938 | 0.0615234 | 0.0644531 | 0.0673828 | 0.0703125 | 0.0732422 | 
0.0761719 | 0.0791016 | 0.0820312 | 0.0849609
?| 0.0878906 | 0.0908203 | 0.09375 | 0.0966797 | 0.0996094 | 0.102539 | 0.105469 
| 0.108398 | 0.111328 | 0.114258
?| 0.117188 | 0.120117 | 0.123047 | 0.125977 | 0.128906 | 0.131836 | 0.134766 | 
0.137695 | 0.140625 | 0.143555
?| 0.146484 | 0.149414 | 0.152344 | 0.155273 | 0.158203 | 0.161133 | 0.164062 | 
0.166992 | 0.169922 | 0.172852
?| 0.175781 | 0.178711 | 0.181641 | 0.18457 | 0.1875 | 0.19043 | 0.193359 | 
0.196289 | 0.199219 | 0.202148
?| 0.205078 | 0.208008 | 0.210938 | 0.213867 | 0.216797 | 0.219727 | 0.222656 | 
0.225586 | 0.228516 | 0.231445
?| 0.234375 | 0.237305 | 0.240234 | 0.243164 | 0.246094 | 0.249023 | 0.251953 | 
0.254883 | 0.257812 | 0.260742
?| 0.263672 | 0.266602 | 0.269531 | 0.272461 | 0.275391 | 0.27832 | 0.28125 | 
0.28418 | 0.287109 | 0.290039
?| 0.292969 | 0.295898 | 0.298828Brain(6480,0xa0047540) malloc: *** 
mmap(size=4263636992) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
?| 0.3
--- Richard Beare <richard.beare at gmail.com> schrieb am Mi, 30.3.2011:

Von: Richard Beare <richard.beare at gmail.com>
Betreff: Re: [Insight-users] LabelShapeOpeningImageFilter Attribute input
An: "Ella Maria Kadas" <ella_kadas at yahoo.com>
CC: "insight-users at itk.org" <insight-users at itk.org>
Datum: Mittwoch, 30. M?rz, 2011 15:03 Uhr

There is a convenience class in the Review directory that is derived from this 
contribution called itk::BinaryShapeOpeningImageFilter. This includes all of the 
labelling and conversion to and from label maps. You just need to call the 
SetAttribute and SetForegroundValue appropriately. It should work fine for 3D. 
If you look inside that class you should also find the standard combination of 
steps you need to go through to use the LabelMap filters.


On Wed, Mar 30, 2011 at 9:09 PM, Ella Maria Kadas <ella_kadas at yahoo.com> wrote:

Hi all,
?? ?I am trying to remove some objects from a 3D image that have a volume lower 
then a specific value.
?? I tried to use the?Label object representation and manipulation with ITK 
that?Gae ?tan Lehmann
implemented but i still don't know what that attribute parameter should look 
like. (in the python example it looks a s it would be a
char?size = 
itk.ShapeOpeningLabelMapFilter[LabelMapType].New(stats,Attribute=?Size?, 
Lambda=100)?
?I want to use the ShapeLabelObject, and it's attributes to do a 
LabelShapeOpeningFilter.?As i was getting no result i tried to do it in 2D 
first.
?This is my code:First i use the ConnectedComponentImageFilter, then 
RelabelComponentImageFilter and create a ShapeLabelMap from the relabel's 
output.


typedef unsigned long LabelType;
? typedef itk::ShapeLabelObject< LabelType, dim > LabelObjectType;
? typedef itk::LabelMap< LabelObjectType > LabelMapType;




? typedef itk::LabelImageToShapeLabelMapFilter< LabelImageType, LabelMapType > 
ConverterType;
? ConverterType::Pointer converter = ConverterType::New();
? converter->SetInput( relabel->GetOutput() );
? converter->Update();
!!!! Why does it not work if i use this part of code from the journal    
    /*and valuate the attributes with the dedicated filter: ShapeLabelMapFilter

typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType; 
ShapeFilterType::Pointer shape = ShapeFilterType::New(); shape->SetInput( 
converter->GetOutput() );

update the shape filter, so its output will be up to date
shape->Update();
*/
??LabelMapType::Pointer labelMap = converter->GetOutput();

std::cout<<"nr of label 
objects"<<labelMap->GetNumberOfLabelObjects()<<std::endl;


? for( unsigned int label=1; label<=labelMap->GetNumberOfLabelObjects(); label++ 
)
? ? {
? ??
? ? const LabelObjectType * labelObject = labelMap->GetLabelObject( label );
? ? std::cout << label << "\t" << labelObject->GetPhysicalSize() << "\t" << 
labelObject->GetCentroid() << std::endl;

? ? }


    typedef itk::LabelShapeOpeningImageFilter< LabelImageType > 
LabelOpeningType;

    LabelOpeningType::Pointer opening = LabelOpeningType::New();

    opening->SetInput( relabel->GetOutput());
    opening->SetBackgroundValue(0);
    opening->SetLambda( 100 );
    opening->SetReverseOrdering( false );
//NO IDEA About the Attribute//I thought it should be the labelMap->Size()) 
should be as attribute

    opening->SetAttribute("PERIMETER");
    itk::SimpleFilterWatcher watcher(opening, "filter");

    
Then i would like to get back the binary image and see it but i can't get the 
proper image types as input to LabelMapToLabelIamgeFilter....So the commented 
part is not working


    /*typedef itk::LabelMapToLabelImageFilter< LabelImageType, LabelImageType > 
L2IType;?

    L2IType::Pointer l2i = L2IType::New();?
    l2i->SetInput( opening->GetOutput() );
    
    typedef itk::ImageFileWriter< LabelImageType > WriterType;
    WriterType::Pointer writer = WriterType::New();
    writer->SetInput( l2i->GetOutput() );
    writer->SetFileName( "/Users/ellaK/Documents/Morphology/Opening.gipl");
    writer->Update();*/
    std::getchar();



Maybe i am doing this the wrong way, and i can't use it for 3D images.
If anybody already already worked with this filters please give me a hint to 
what i am doing wrong.Thanks,?? Ella

_____________________________________

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.html



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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.itk.org/pipermail/insight-users/attachments/20110330/c907c66f/attachment-0001.htm>


------------------------------

Message: 3
Date: Wed, 30 Mar 2011 16:32:07 +0200
From: Ga?tan Lehmann <gaetan.lehmann at jouy.inra.fr>
Subject: Re: [Insight-users] Possible bug in Label Overlay Filter
To: Maria Alejandra Zuluaga Valencia <mariazulv at yahoo.es>
Cc: ITK list <insight-users at itk.org>
Message-ID: <15A0F6C9-5172-4A2F-9E97-4AEE690AF31B at jouy.inra.fr>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed";
    DelSp="yes"


Hi,

Could you provide a small code to reproduce that problem?

Thanks,

Ga?tan


Le 28 mars 11 ? 16:48, Maria Alejandra Zuluaga Valencia a ?crit :

> Hello again,
>
> Earlier this morning I posted a message on problems with  
> ExtractImageFilter (which I put at the end of the message for follow- 
> up purposes).
> I've performed several tests to find the cause of my error. Since,  
> the input images I was using came from  itkLabelOverlayImageFilter,  
> right now I am under the hypothesis that the latter is the one that  
> really causes the problem when 3D images are used.
>
> In my pipeline I am able of creating a 3D RGB image (mhd/raw format)  
> and I can visualize it without any problem. However, once I try to  
> do something with this resulting image I get problems.
>
> At the beginning I was using ExtractImageFilter to obtain a single  
> slice from the overlaid image. Since it did not work, I performed  
> the simplest operation which consisted in reading  from disk the 3D  
> RGB image and then writing it again. In every case, the resulting  
> image contains only noise. If I do this same test with a 2D overlaid  
> image, it works perfectly.
>
> Has anyone experienced the same problem? is there anyway to solve it?
>
> thanks in advance,
>
> Maria A. Zuluaga
>
> Maybe there are some problems regarding R G B channel interleaving/ 
> separation?
>
> HTH
>
> On Mon, Mar 28, 2011 at 12:05, Maria Alejandra Zuluaga Valencia 
><mariazulv at yahoo.es 
>
> > wrote:
> Hi,
> I am using the ExtractImageFilter to obtain a 2D slice from a 3D  
> volume. I used the example from the user's guide and it works OK.  
> However, when I change the pixel type to RGB (I want to do this for  
> some overlay images) it fails. The resulting slice is completely  
> noisy. Any idea?
>
> Thanks in advance,
>
> Maria A. Zuluaga
>
>
> _____________________________________
> 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.html
>
> 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
>
>
>
> _____________________________________
> 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.html
>
> 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

-- 
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  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: 
<http://www.itk.org/pipermail/insight-users/attachments/20110330/b1c65619/attachment-0001.pgp>


------------------------------

Message: 4
Date: Wed, 30 Mar 2011 16:44:42 +0200
From: Ga?tan Lehmann <gaetan.lehmann at jouy.inra.fr>
Subject: Re: [Insight-users] LabelShapeOpeningImageFilter Attribute
    input
To: Ella Maria Kadas <ella_kadas at yahoo.com>
Cc: "insight-users at itk.org" <insight-users at itk.org>
Message-ID: <D1ABD4AA-848E-4EFA-9D10-B631159147C9 at jouy.inra.fr>
Content-Type: text/plain; charset="utf-8"; Format="flowed";
    DelSp="yes"

Hi,


Le 30 mars 11 ? 14:51, Ella Maria Kadas a ?crit :

> Hi,
>
>  Yes i already tried that and in the by default the Attribute value  
> is "Size", which as far as i understood is the Perimeter of the shape

This is the number of pixels in the object. It has been renamed in ITK  
v4 in NumberOfPixels.

> that has a specific label (length-coding)-don't know how that  
> applies to 3D images,

that's still the number of pixels independently of the image  
dimension :-)

> but trying to apply the itkBinaryShapeOpeningImageFilter i get the  
> following error (my input image is a float one).

Your image should have an integer pixel type. There is no point in  
using that class with a real pixel type.
I'm not sure this is your problem, though. Can you provide a minimum  
example so we can try to reproduce the problem?

Regards,

Ga?tan

> Start BinaryShapeOpeningImageFilter "filter"  
> BinaryShapeOpeningImageFilter (0x402d160)
>   RTTI typeinfo:    
> itk::BinaryShapeOpeningImageFilter<itk::Image<float, 3u> >
>   Reference Count: 3
>   Modified Time: 1082
>   Debug: Off
>   Observers:
>     StartEvent(SimpleMemberCommand)
>     EndEvent(SimpleMemberCommand)
>     ProgressEvent(SimpleMemberCommand)
>     IterationEvent(SimpleMemberCommand)
>     AbortEvent(SimpleMemberCommand)
>   Number Of Required Inputs: 1
>   Number Of Required Outputs: 1
>   Number Of Threads: 8
>   ReleaseDataFlag: Off
>   ReleaseDataBeforeUpdateFlag: Off
>   Input 0: (0x402cde0)
>   Output 0: (0x402d380)
>   AbortGenerateData: Off
>   Progress: 0
>   Multithreader:
>     RTTI typeinfo:   itk::MultiThreader
>     Reference Count: 1
>     Modified Time: 1069
>     Debug: Off
>     Observers:
>       none
>     Thread Count: 8
>     Global Maximum Number Of Threads: 128
>     Global Default Number Of Threads: 8
>   FullyConnected: 0
>   BackgroundValue: 0
>   ForegroundValue: 255
>   Lambda: 500
>   ReverseOrdering: 0
>   Attribute: Size (0)
> Progress  | 0 | 0.00292969 | 0.00585938 | 0.00878906 | 0.0117188 |  
> 0.0146484 | 0.0175781 | 0.0205078 | 0.0234375 | 0.0263672
>  | 0.0292969 | 0.0322266 | 0.0351562 | 0.0380859 | 0.0410156 |  
> 0.0439453 | 0.046875 | 0.0498047 | 0.0527344 | 0.0556641
>  | 0.0585938 | 0.0615234 | 0.0644531 | 0.0673828 | 0.0703125 |  
> 0.0732422 | 0.0761719 | 0.0791016 | 0.0820312 | 0.0849609
>  | 0.0878906 | 0.0908203 | 0.09375 | 0.0966797 | 0.0996094 |  
> 0.102539 | 0.105469 | 0.108398 | 0.111328 | 0.114258
>  | 0.117188 | 0.120117 | 0.123047 | 0.125977 | 0.128906 | 0.131836 |  
> 0.134766 | 0.137695 | 0.140625 | 0.143555
>  | 0.146484 | 0.149414 | 0.152344 | 0.155273 | 0.158203 | 0.161133 |  
> 0.164062 | 0.166992 | 0.169922 | 0.172852
>  | 0.175781 | 0.178711 | 0.181641 | 0.18457 | 0.1875 | 0.19043 |  
> 0.193359 | 0.196289 | 0.199219 | 0.202148
>  | 0.205078 | 0.208008 | 0.210938 | 0.213867 | 0.216797 | 0.219727 |  
> 0.222656 | 0.225586 | 0.228516 | 0.231445
>  | 0.234375 | 0.237305 | 0.240234 | 0.243164 | 0.246094 | 0.249023 |  
> 0.251953 | 0.254883 | 0.257812 | 0.260742
>  | 0.263672 | 0.266602 | 0.269531 | 0.272461 | 0.275391 | 0.27832 |  
> 0.28125 | 0.28418 | 0.287109 | 0.290039
>  | 0.292969 | 0.295898 | 0.298828Brain(6480,0xa0047540) malloc: ***  
> mmap(size=4263636992) failed (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
>  | 0.3
>
> --- Richard Beare <richard.beare at gmail.com> schrieb am Mi, 30.3.2011:
>
> Von: Richard Beare <richard.beare at gmail.com>
> Betreff: Re: [Insight-users] LabelShapeOpeningImageFilter Attribute  
> input
> An: "Ella Maria Kadas" <ella_kadas at yahoo.com>
> CC: "insight-users at itk.org" <insight-users at itk.org>
> Datum: Mittwoch, 30. M?rz, 2011 15:03 Uhr
>
> There is a convenience class in the Review directory that is derived  
> from this contribution called itk::BinaryShapeOpeningImageFilter.  
> This includes all of the labelling and conversion to and from label  
> maps. You just need to call the SetAttribute and SetForegroundValue  
> appropriately. It should work fine for 3D. If you look inside that  
> class you should also find the standard combination of steps you  
> need to go through to use the LabelMap filters.
>
> On Wed, Mar 30, 2011 at 9:09 PM, Ella Maria Kadas <ella_kadas at yahoo.com 
> > wrote:
> Hi all,
>
>     I am trying to remove some objects from a 3D image that have a  
> volume lower then a specific value.
>    I tried to use the Label object representation and manipulation  
> with ITK that Gae ?tan Lehmann
> implemented but i still don't know what that attribute parameter  
> should look like. (in the python example it looks a s it would be a  
> char
> size =  
> itk 
> .ShapeOpeningLabelMapFilter 
> [LabelMapType].New(stats,Attribute=?Size?, Lambda=100)
>  I want to use the ShapeLabelObject, and it's attributes to do a  
> LabelShapeOpeningFilter.
>  As i was getting no result i tried to do it in 2D first.
>  This is my code:
> First i use the ConnectedComponentImageFilter, then  
> RelabelComponentImageFilter and create a ShapeLabelMap from the  
> relabel's output.
>
> typedef unsigned long LabelType;
>   typedef itk::ShapeLabelObject< LabelType, dim > LabelObjectType;
>   typedef itk::LabelMap< LabelObjectType > LabelMapType;
>
>
>   typedef itk::LabelImageToShapeLabelMapFilter< LabelImageType,  
> LabelMapType > ConverterType;
>   ConverterType::Pointer converter = ConverterType::New();
>   converter->SetInput( relabel->GetOutput() );
>   converter->Update();
> !!!! Why does it not work if i use this part of code from the journal
> /*
>
> and valuate the attributes with the dedicated filter:  
> ShapeLabelMapFilter
> typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType;  
> ShapeFilterType::Pointer shape = ShapeFilterType::New(); shape- 
> >SetInput( converter->GetOutput() );
> update the shape filter, so its output will be up to date
> shape->Update();
>
> */
>
>
>   LabelMapType::Pointer labelMap = converter->GetOutput();
> std::cout<<"nr of label objects"<<labelMap- 
> >GetNumberOfLabelObjects()<<std::endl;
>
>   for( unsigned int label=1; label<=labelMap- 
> >GetNumberOfLabelObjects(); label++ )
>     {
>
>     const LabelObjectType * labelObject = labelMap- 
> >GetLabelObject( label );
>     std::cout << label << "\t" << labelObject->GetPhysicalSize() <<  
> "\t" << labelObject->GetCentroid() << std::endl;
>     }
>
> typedef itk::LabelShapeOpeningImageFilter< LabelImageType >  
> LabelOpeningType;
> LabelOpeningType::Pointer opening = LabelOpeningType::New();
> opening->SetInput( relabel->GetOutput());
> opening->SetBackgroundValue(0);
> opening->SetLambda( 100 );
> opening->SetReverseOrdering( false );
> //NO IDEA About the Attribute
> //I thought it should be the labelMap->Size()) should be as attribute
> opening->SetAttribute("PERIMETER");
> itk::SimpleFilterWatcher watcher(opening, "filter");
>
> Then i would like to get back the binary image and see it but i  
> can't get the proper image types as input to  
> LabelMapToLabelIamgeFilter....So the commented part is not working
>
> /*typedef itk::LabelMapToLabelImageFilter< LabelImageType,  
> LabelImageType > L2IType;
> L2IType::Pointer l2i = L2IType::New();
> l2i->SetInput( opening->GetOutput() );
>
> typedef itk::ImageFileWriter< LabelImageType > WriterType;
> WriterType::Pointer writer = WriterType::New();
> writer->SetInput( l2i->GetOutput() );
> writer->SetFileName( "/Users/ellaK/Documents/Morphology/ 
> Opening.gipl");
> writer->Update();*/
> std::getchar();
>
>
>
> Maybe i am doing this the wrong way, and i can't use it for 3D images.
> If anybody already already worked with this filters please give me a  
> hint to what i am doing wrong.
> Thanks,
>    Ella
>
> _____________________________________
> 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.html
>
> 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
>
>
> _____________________________________
> 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.html
>
> 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

-- 
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  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: 
<http://www.itk.org/pipermail/insight-users/attachments/20110330/91353cb7/attachment-0001.pgp>


------------------------------

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


End of Insight-users Digest, Vol 83, Issue 56
*********************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110404/e53ffb93/attachment-0001.htm>


More information about the Insight-users mailing list