[ITK-users] Region of two labelObjects

Arnaud Gelas arnaudgelas at gmail.com
Fri Apr 17 09:24:59 EDT 2015


Hi Brad,

It is an excellent idea to extract attributes calculation from Shape/StatisticsLabelMapFilter to be able to reuse it.
I can give a hand on this effort, but to be honest I have really high interest on the bounding box / region and can work this one out from early next week.

Arnaud



> On 17 Apr 2015, at 15:04, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> 
> Hi,
> 
> So essentially you are talking about moving some computational code from the ShapeLabelMapFilter [1]  into the LabelObject class? As there is already an ShapeLabelObject::GetBoundingBox method perhaps the naming of LabelObject::ComputeBoundingBox would be appropriate?
> 
> In general the design of the LabelMap frame work should be considered. Currently, it's a very pipeline focus approach, where all the LabelMap attributes are computed as in filters. This is different than other label statistics frameworks where the the attributes are computed on demand when needed. It's a slippery slope to add procedural computational methods one by one to classes.
> 
> One option to consider to to refactor the code which calculates attributes in the ShapeLabelMapFilter and StatisticsLabelMapFilter in to a type of Calculator support class? So that the same code can be reused by multiple filters and procedural methods?
> 
> Just a thought,
> HTH,
> Brad
> 
> [1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx#L272-L283 <https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx#L272-L283>
> 
> On Apr 17, 2015, at 8:47 AM, Arnaud Gelas <arnaudgelas at gmail.com <mailto:arnaudgelas at gmail.com>> wrote:
> 
>> More precisely, I’d be really interested in having a BoundingBox or Region for each LabelObject by using one method (I do not really need to maintain it), and then it can be directly be deduced form each LabelObject.
>> 
>> If that’s ok with you, early next week I could add one method to the LabelObject to get such information (?), then you can still work main features you need.
>> 
>> Arnaud
>> 
>>> On 17 Apr 2015, at 14:24, Pol Monsó Purtí <lluna.nova at gmail.com <mailto:lluna.nova at gmail.com>> wrote:
>>> 
>>> Yes sorry I had to pospone it because of an stressful deadline I have, but hopefully next week, two tops.
>>> 
>>> 2015-04-17 12:09 GMT+02:00 Arnaud Gelas <arnaudgelas at gmail.com <mailto:arnaudgelas at gmail.com>>:
>>> Hi Pol,
>>> 
>>> I am extremely interested in this change!!!
>>> Do you have any idea when you think you could submit a patch for it?
>>> 
>>> thanks,
>>> Arnaud
>>> 
>>> On Fri, Apr 3, 2015 at 6:44 PM, Pol Monsó Purtí <lluna.nova at gmail.com <mailto:lluna.nova at gmail.com>> wrote:
>>> Thanks Matt,
>>> 
>>> I've set the Git and Gerrit access. I believe everything's ok. I'll get to it next Tuesday.
>>> 
>>> Cheers,
>>> 
>>> Pol
>>> 
>>> 2015-04-02 15:22 GMT+02:00 Matt McCormick <matt.mccormick at kitware.com <mailto:matt.mccormick at kitware.com>>:
>>> Hi Pol,
>>> 
>>> Thanks for considering make improvements to this code.  Instructions
>>> to submit a patch can be found here [1].  Please let us know if you
>>> have any questions.
>>> 
>>> Thanks,
>>> Matt
>>> 
>>> [1] https://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/SubmitAPatchToGerrit/index.html <https://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/SubmitAPatchToGerrit/index.html>
>>> 
>>> On Thu, Apr 2, 2015 at 8:52 AM, Pol Monsó Purtí <lluna.nova at gmail.com <mailto:lluna.nova at gmail.com>> wrote:
>>> > Hello Gaëtan,
>>> >
>>> > Yes I agree, Thinking about it later I also reached the same conclusion that
>>> > a filter that changes the regions internally without warning could be a
>>> > pitfall.
>>> >
>>> > The RegionFromReferenceLabelMapFilter might actually work for me given that
>>> > I do have the original ROI region and roi image, but I can implement the
>>> > ComputeBoundingBox() function anyway, it's cleaner if I don't use the
>>> > original ROI.
>>> >
>>> > What's the workflow for submitting code? Fork the itk repository, add the
>>> > method and PR or something else?
>>> >
>>> > If you'd rather have a filter that does this, I unfortunatelly won't have
>>> > the time to do it this month (and maybe next)...
>>> >
>>> > Cheers,
>>> >
>>> > Pol
>>> >
>>> >
>>> >
>>> > 2015-04-02 14:32 GMT+02:00 Gaetan Lehmann <gaetan.lehmann at gmail.com <mailto:gaetan.lehmann at gmail.com>>:
>>> >>
>>> >> Hi Pol,
>>> >>
>>> >> 2015-03-30 23:02 GMT+02:00 Pol Monsó Purtí <lluna.nova at gmail.com <mailto:lluna.nova at gmail.com>>:
>>> >>>
>>> >>>
>>> >>> Hello all,
>>> >>>
>>> >>> I have two label objects, how can I merge the two BoundingBoxes together
>>> >>> so I know the necessary size of the image? (other than creating it myself by
>>> >>> searching max/min of each dimension)
>>> >>>
>>> >>> How come LabelMap doesn't resize automatically when objects are added? It
>>> >>> could.
>>> >>
>>> >>
>>> >> The LabelMap class was designed to work as much as possible as the Image
>>> >> class, that does not have this kind of behavior, and to avoid as much as
>>> >> possible the costly operations.
>>> >>
>>> >> So while I don't think this should be done automatically, we should have
>>> >> some methods or filters to make this easy to do.
>>> >>
>>> >> There are a few filters to manipulate the regions of a LabelMap, but none
>>> >> of them does exactly what you need:
>>> >>
>>> >> * PadLabelMapFilter that can enlarge the LabelMap region, but not based on
>>> >> its content
>>> >> * CropLabelMapFilter that can shrink the LabelMap region, but not based on
>>> >> its content
>>> >> * RegionFromReferenceLabelMapFilter that makes the LabelMap region match
>>> >> the region of a reference input image
>>> >> * AutoCropLabelMapFilter that reduce the region covered by a label map
>>> >> based on its content, but can't enlarge it
>>> >>
>>> >> In my opinion, we should have a ComputeBoundingBox() method in LabelMap
>>> >> that compute the region covered by all the label objects - the code can be
>>> >> moved from AutoCropLabelMapFilter. We could then do
>>> >>
>>> >>   labelMap->AddLabelObject(labelObject1);
>>> >>   labelMap->AddLabelObject(labelObject2);
>>> >>   labelMap->SetRegions(labelMap->ComputeBoundingBox());
>>> >>
>>> >> to update the region.
>>> >>
>>> >> Would you agree to implement such a method for the LabelMap class?
>>> >>
>>> >> Optionally, we could also think to a filter to do that in a pipeline.
>>> >>
>>> >> Regards,
>>> >>
>>> >> Gaëtan
>>> >>
>>> >
>>> >
>>> >
>>> > _____________________________________
>>> > Powered by www.kitware.com <http://www.kitware.com/>
>>> >
>>> > Visit other Kitware open-source projects at
>>> > http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>>> >
>>> > Kitware offers ITK Training Courses, for more information visit:
>>> > http://www.kitware.com/products/protraining.php <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 <http://www.itk.org/Wiki/ITK_FAQ>
>>> >
>>> > Follow this link to subscribe/unsubscribe:
>>> > http://public.kitware.com/mailman/listinfo/insight-users <http://public.kitware.com/mailman/listinfo/insight-users>
>>> >
>>> 
>>> 
>>> _____________________________________
>>> Powered by www.kitware.com <http://www.kitware.com/>
>>> 
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>>> 
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php <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 <http://www.itk.org/Wiki/ITK_FAQ>
>>> 
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/insight-users <http://public.kitware.com/mailman/listinfo/insight-users>
>>> 
>>> 
>>> 
>> 
>> _____________________________________
>> Powered by www.kitware.com <http://www.kitware.com/>
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html <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://public.kitware.com/mailman/listinfo/insight-users
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150417/69806979/attachment-0001.html>


More information about the Insight-users mailing list