[ITK] [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/community/attachments/20150330/b7d1f124/attachment-0001.html>
-------------- next part --------------
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list