[Insight-users] LabelShapeOpeningImageFilter Attribute input
Ella Maria Kadas
ella_kadas at yahoo.com
Wed Mar 30 08:51:23 EDT 2011
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.htm>
More information about the Insight-users
mailing list