<div>I&#39;ve been using LabelMap related filters and had a </div><div>few issues with them. These issues could stem from my </div><div>lack of knowledge about the design of these filters but I thought </div><div>it is good to have them on the list so that someone else could benefit </div>
<div>from or maybe some sort of cleanup can be performed on them. </div><div><br></div><div>1) LabelObject::SetLabel method has no </div><div>effect as the labels are stored in the LabelMap. If one</div><div>wants to change the labels, they need to go through the </div>
<div>ChangeLabelMapFilter or RelabelLabelMapFilter. </div><div><br></div><div>This function is just confusing as you can not properly </div>

<div>change the label, but it gives you the impression</div><div>that the label is changed. Either LabelObject::SetLabel </div><div>should do the expected behavior and change the label, </div><div>or this method should be dropped or renamed or return</div>
<div>something to warn you. </div>

<div><br></div><div>2) Assuming that I have a labelobject that I created somehow...</div><div>When I want to add this labelobject to a labelmap, there </div><div>are two functions available. </div>

<div>LabelMap::AddLabelObject </div><div>LabelMap::PushLabelObject </div><div><br></div><div>PushLabelObject searches for an unused label(largest label+1), </div><div>whereas AddLabelObject does not. If the label of the object at </div>
<div>hand clashes with another one in the labelmap, AddLabelObject</div>

<div>does not warn you, and just overwrites whatever was there. </div><div>PushLabelObject on the other hand looks for an unused label,</div><div>and changes the label of the object with whatever is available. </div><div>
<br></div><div>

It is nice to have these two different options but these should be </div><div>explicitly stated somewhere. I would also suggest to propagate </div><div>the return value (pair&lt;iter,bool&gt;) of the STL map&#39;s insert, instead </div>
<div>of having just void.</div><div><br></div><div>3) All the features are accessed by GetProperty methods, </div><div><div>e.g. GetBoundingBox, GetPhysicalSize etc except </div><div>the size. It took me a while to realize that the function </div>
<div>was not GetSize but just Size. I would expect to have</div><div>GetSize instead of Size. </div></div><div><br></div><div>4) There are multiple ways of converting the label map</div>

<div>to an image but as far as I can see no direct support of </div><div>converting &quot;a&quot; label object to its corresponding image</div><div><br></div><div>i) I need to create a new empty label map, </div><div>ii) call copyInformation or SetRegions with the </div>
<div>bounding box of the object depending on the </div><div>type of image I am interested</div>

<div>iii) add the labelobject to the labelmap</div><div>iv) and then use labelmaptolabelimage filter.</div><div><br></div><div>I guess a GetImage function could be provided. </div><div><br></div><div>5) If for some reason, possibly due to a not well thought design of mine,</div>


<div>I call BinaryImagetoShapeLabelMap with int type, </div><div>the InputforegroundValue is set to -1 and </div><div>the OutputBackgroundValue is set to 0 by the filter by default. </div><div><div>I would expect the default InputForegroundValue to be </div>
<div>+max int or 1 or 255, but not -1. </div></div><div><br></div><div>6) In BinaryImagetoShapeLabelMap</div><div>there is <font face="&#39;Lucida Grande&#39;, Verdana, Geneva, Arial, sans-serif"><span style="font-size:12px">SetInputForegroundValue to modify the foreground but </span></font></div>


<div><font face="&#39;Lucida Grande&#39;, Verdana, Geneva, Arial, sans-serif"><span style="font-size:12px">there is no SetInputBackgroundValue. </span></font><font face="&#39;Lucida Grande&#39;, Verdana, Geneva, Arial, sans-serif"><span style="font-size:12px">Likewise, SetOutputBackgroundValue </span></font></div>
<div><font face="&#39;Lucida Grande&#39;, Verdana, Geneva, Arial, sans-serif"><span style="font-size:12px">exists, but SetOutputForegroundValue </span></font><font face="&#39;Lucida Grande&#39;, Verdana, Geneva, Arial, sans-serif"><span style="font-size:12px">does not exists. </span></font><span style="font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;background-color:rgb(249,250,252)"> </span></div>


<div>I would expect the missing functions to be available unless </div><div>there is good reason to not to. </div><div><br></div><div>7) The return type for RemoveLabel, RemoveLabelObject in </div><div><div>LabelMap class are void. STL map tells how many </div>
<div>objects are removed with the corresponding function prototype. </div><div>This information can be provided to the caller. </div></div><div><br></div><div>Kind Regards, </div><div>Cagatay</div>