[Insight-users] label map and label image manipulation
Cagatay Bilgin
bilgincc at gmail.com
Tue Nov 8 02:34:43 EST 2011
I will be responding my own incase someone else needs this in the
future. I wasn't completely sure but found it easier to work on the
LabelMap itself, instead of performing these on the LabelImage. One
can always create a new LabelImage once he has an upto date labelmap
anyway.
i) separate a label object into two:
Created and added two new label objects and deleted the previous one
from the labelmap. The labelobject apparently has an indexiterator
which was very helpful.
// Iterate over all the indexes
typename LabelObjectType::ConstIndexIterator indexIt( labelObject );
while( ! indexIt.IsAtEnd() ){
typename LabelObjectType::IndexType idx = indexIt.GetIndex();
...
newObject1->AddIndex(idx);
...
}
ii) remove the label belonging to the original object from the
LabelImage:
Don't need to do this as I work on the labelmap itself. The nicely put
LabelmapToLabelImage class later produces a labelimage for me provided
that I keep my labelmap accurately.
iii) and add the newly created two objects to the LabelImage with
unique labels across the image.
finding a unique label can be performed by iterating over all the
labelobjects in the labelmap and finding the maximum label.
int oldLabel = labelObject->GetLabel();
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/label-map-and-label-image-manipulation-tp6971760p6973401.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list