[Insight-users] [ITK Community] mini-pipeline output region problem

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Feb 4 11:09:28 EST 2014


Matt,

The itkAutoCropLabelMapFilter is not a normal Filter. It doesn't behave like a filter is expected to do.  It fact it performs most of it's work in the UpdateOutputInformation as opposed to the GenerateData as is normal[1]. I will simply say that this AutoCrop filter is not suitable for use in a composite filter with a mini-pipeline. More generally many ImageGrid type filters which change the OutputInformation are very challenging to use in a composite filter due to the need to reimplement the UpdateOutputInformation method correctly to match that produce by the mini-pipeline.

I don't quite get what you are trying to do in your composite filter. It's seem like you are just trying to crop a single label. It may be easier to just do this with two fitlers and not try to composite them. 

Related to this, I have a module which I have used which crops labels into images based on label maps bounding boxes. I used to to crop thousands of small elements in a segmented image. It's an external module[2]. Of interest is its usage[3] and implementation. I basically looked at the problem as adding the small cropped image as part to the LabelMap's Attributes.

Hope this helps,
Brad

[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/LabelMap/include/itkAutoCropLabelMapFilter.hxx#L44:L121
[2] https://github.com/blowekamp/itkOBBLabelMap
[3] https://github.com/blowekamp/itkOBBLabelMap/blob/master/test/itkBoundingBoxImageLabelMapFilterTest.cxx
[4] https://github.com/blowekamp/itkOBBLabelMap/blob/master/include/itkBoundingBoxImageLabelMapFilter.hxx

On Feb 4, 2014, at 10:38 AM, Matt McCormick <matt.mccormick at kitware.com> wrote:

> Hi Matthew,
> 
> GenerateOutputInformation() should only generate the information
> (spacing, etc.) of the data outputs so when UpdateOutputInformation()
> is called on the pipeline, all the outputs have the correct
> information.  GenerateData() should populate the output pixels.
> 
> This is covered in further detail in the ITK Software Guide [1] in
> "How to Write a Filter".
> 
> Have a great day,
> Matt
> 
> [1] http://itk.org/ItkSoftwareGuide.pdf
> 
> On Tue, Feb 4, 2014 at 5:35 AM, matthew <mrrm at web.de> wrote:
>> Hi Matt,
>> 
>> just had a look at your suggestion. It should work out for me. Realized that
>> initially the parameters are copied from the input.
>> 
>> Unfortunatly, GenerateOutputInformation gets called before the GenerateData,
>> so I need to restructure things.
>> 
>> But I am still a bit confused, because if I inspect the output of the filter
>> at the end of the GenerateData everything is correct.
>> 
>> So does the filter have an own spacing, lpr... variable, which is passed to
>> the writer?
>> Or does this happen before the GenerateData gets called?
>> 
>> Thanks for helping.
>> Have a nice day,
>> Matthew
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://itk-users.7.n7.nabble.com/mini-pipeline-output-region-problem-tp33314p33319.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://www.itk.org/mailman/listinfo/insight-users
>> _______________________________________________
>> Community mailing list
>> Community at itk.org
>> http://public.kitware.com/cgi-bin/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://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list