[ITK-users] Region of two labelObjects
Pol Monsó Purtí
lluna.nova at gmail.com
Mon Mar 30 17:02:38 EDT 2015
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.
template< typename TImageType >
void labelObjects2Image(ShapeLabelObjectType* labelObject1,
ShapeLabelObjectType* labelObject2,
typename TImageType::Pointer& labelMapImage){
typedef itk::ShapeLabelObject< typename TImageType::PixelType,
TImageType::ImageDimension > ShapeLabelObjectType;
typedef itk::LabelMap< ShapeLabelObjectType > LabelMapType;
typedef itk::LabelMapToLabelImageFilter< LabelMapType, TImageType >
Label2VolumeFilter;
*--> region = labelObject1->GetBoundingBox() "+"
labelObject2->GetBoundingBox()*
auto segLabelMap = LabelMapType::New();
segLabelMap->SetRegions(region);
segLabelMap->Allocate();
segLabelMap->AddLabelObject(labelObject1);
segLabelMap->AddLabelObject(labelObject2);
auto label2volume = Label2VolumeFilter::New();
label2volume->SetInput(segLabelMap);
label2volume->Update();
labelMapImage = label2volume->GetOutput();
}
Cheers,
Pol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150330/b7d1f124/attachment.html>
More information about the Insight-users
mailing list