<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>Since I believe that the LabelMap filters change the regions do next to no work, as they can just change the meta-data and the label object can be just grafted when the filter is run in place.</div><div><br></div><div>Practically speaking you could just Pad by 10000, then use the AutoCrop to get the desired results? This should still be very efficient since there is not per-pixel based operations done.</div><div><br></div><div>HTH,</div><div>Brad</div><div><br><div><div>On Apr 2, 2015, at 8:52 AM, Pol Monsó Purtí <<a href="mailto:lluna.nova@gmail.com">lluna.nova@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div><div>Hello Gaëtan,<br><br></div>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.<br><br></div>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.<br><div><div><br></div><div>What's the workflow for submitting code? Fork the itk repository, add the method and PR or something else?<br><br></div><div>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)...</div><br><div>Cheers,<br><br></div><div>Pol<br></div><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-02 14:32 GMT+02:00 Gaetan Lehmann <span dir="ltr"><<a href="mailto:gaetan.lehmann@gmail.com" target="_blank">gaetan.lehmann@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Pol,<br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2015-03-30 23:02 GMT+02:00 Pol Monsó Purtí <span dir="ltr"><<a href="mailto:lluna.nova@gmail.com" target="_blank">lluna.nova@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">Hello all,<br><br>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) <br><br>How come LabelMap doesn't resize automatically when objects are added? It could.<br></div></div></div></blockquote><div><br></div></span><div>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.</div><div><br></div><div>So while I don't think this should be done automatically, we should have some methods or filters to make this easy to do.<br></div><div><br></div><div><div>There are a few filters to manipulate the regions of a LabelMap, but none of them does exactly what you need:</div><div><br></div><div>* PadLabelMapFilter that can enlarge the LabelMap region, but not based on its content</div><div>* CropLabelMapFilter that can shrink the LabelMap region, but not based on its content</div><div>* RegionFromReferenceLabelMapFilter that makes the LabelMap region match the region of a reference input image</div><div>* AutoCropLabelMapFilter that reduce the region covered by a label map based on its content, but can't enlarge it<br></div><div><br></div></div><div>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</div><div><br></div><div> labelMap->AddLabelObject(labelObject1);</div><div> labelMap->AddLabelObject(labelObject2);</div><div> labelMap->SetRegions(labelMap->ComputeBoundingBox());</div><div><br></div><div>to update the region. </div><div><br></div><div>Would you agree to implement such a method for the LabelMap class?</div><div><br></div><div>Optionally, we could also think to a filter to do that in a pipeline.<br></div><div><br></div><div>Regards,</div><div><br></div><div>Gaëtan <br></div><div> </div></div></div></div>
</blockquote></div><br></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://public.kitware.com/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>