[Insight-users] Rescale label image

Bill Lorensen bill.lorensen at gmail.com
Tue Jun 12 12:14:51 EDT 2012


/**
 * \class RelabelComponentImageFilter
 * \brief Relabel the components in an image such that consecutive
labels are used.
 *
 * RelabelComponentImageFilter remaps the labels associated with the
 * objects in an image (as from the output of
 * ConnectedComponentImageFilter) such that the label numbers are
 * consecutive with no gaps between the label numbers used.  By
 * default, the relabeling will also sort the labels based on the size
 * of the object: the largest object will have label #1, the second
 * largest will have label #2, etc.
 *
 * Label #0 is assumed to be background is left unaltered by the
 * relabeling.
*/

On Tue, Jun 12, 2012 at 11:43 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
> I have an image containing labeled objects. The number of objects is about
> 10. However object labels are not consecutive (1,2,3...) as I would like
> them to be, but are scaled to 255.
>
> In case of 2 objects, labels would be 0(background), 127, 255.
>
> However ShiftScaleImageFilter does not seem a safe way to switch back. There
> is  ChangeLabelImageFilter, but it sorts the labels by object size. Is there
> a parameter to make this filter not sort labels? If not, what is the easiest
> way to accomplish this?
>
>
> _____________________________________
> 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
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the Insight-users mailing list