<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr"><div><div>Hello all,<br><br>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) <br><br>How come LabelMap doesn't resize automatically when objects are added? It could.<br><br><span style="font-family:monospace,monospace">template< typename TImageType ><br>void labelObjects2Image(ShapeLabelObjectType* labelObject1,<br> ShapeLabelObjectType* labelObject2,<br> typename TImageType::Pointer& labelMapImage){<br></span><br><span style="font-family:monospace,monospace">typedef itk::ShapeLabelObject< typename TImageType::PixelType, TImageType::ImageDimension > ShapeLabelObjectType;<br>typedef itk::LabelMap< ShapeLabelObjectType > LabelMapType;<br>typedef itk::LabelMapToLabelImageFilter< LabelMapType, TImageType > Label2VolumeFilter;<br><br></span></div><div><b><i><span style="font-family:monospace,monospace">--> region = </span><span style="font-family:monospace,monospace">labelObject1->GetBoundingBox() "+" </span><span style="font-family:monospace,monospace"></span><span style="font-family:monospace,monospace">labelObject2->GetBoundingBox()</span></i></b></div><div><span style="font-family:monospace,monospace"><br>auto segLabelMap = LabelMapType::New();<br>segLabelMap->SetRegions(region);<br>segLabelMap->Allocate();<br><br>segLabelMap->AddLabelObject(labelObject1);<br>segLabelMap->AddLabelObject(labelObject2);<br><br>auto label2volume = Label2VolumeFilter::New();<br><br>label2volume->SetInput(segLabelMap);<br><br>label2volume->Update();<br>labelMapImage = label2volume->GetOutput();<br><br>}<br><br></span></div><span style="font-family:monospace,monospace">Cheers,<br><br></span></div><span style="font-family:monospace,monospace">Pol<br></span></div>
<br></div><br></div>