[ITK-users] Region of two labelObjects

Pol Monsó Purtí lluna.nova at gmail.com
Thu Apr 2 08:52:23 EDT 2015


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>:

> Hi Pol,
>
> 2015-03-30 23:02 GMT+02:00 Pol Monsó Purtí <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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150402/ccb911e6/attachment.html>


More information about the Insight-users mailing list