<div>Hello and happy new years ITK community, </div><div><br></div><div>I am having trouble understanding the output of </div><div>itkMergeLabelMapFilter. I am attaching a </div><div>simple program that creates 4 labelmaps</div>
<div>each holding one label object. After running </div><div>the mergelabelmapfilter, I expect to see </div><div>a labelmap with 4 labelobjects in it, but for </div><div>some reason there are 7 objects. When I look</div><div>
at the objects in the map, I see that some of </div><div>them are repeated (not illustrated in the attached</div><div>code). Could this be a bug or I am missing something </div><div>here?</div><div><br></div><div><div>Thank you, </div>
<div>Cagatay </div></div><div><br></div><div><br></div><div><div>#include "itkBinaryImageToShapeLabelMapFilter.h"</div><div>#include "itkMergeLabelMapFilter.h"</div><div><br></div><div>int</div><div>
main(int argc, char* argv[])</div><div>{</div><div> // Input and Output image types</div><div> typedef itk::Image<int, 3> ImageType;</div><div> </div><div> //Binary Image to Shape Label Map. </div><div> typedef itk::BinaryImageToShapeLabelMapFilter<ImageType> BI2SLMType;</div>
<div> typedef BI2SLMType::OutputImageType LabelMapType;</div><div> typedef BI2SLMType::LabelObjectType LabelObjectType;</div><div> </div><div> typedef itk::MergeLabelMapFilter<LabelMapType> MergerType;</div><div>
typename MergerType::Pointer merger = MergerType::New();</div><div> </div><div> int noObjects = 4;</div><div> </div><div> for(int i=1; i <= noObjects; i++){</div><div> LabelMapType::Pointer labelMap = LabelMapType::New();</div>
<div> LabelObjectType::Pointer labelObject = LabelObjectType::New();</div><div><br></div><div> labelObject->SetLabel(1);</div><div> labelMap->AddLabelObject(labelObject);</div><div> labelMap->Update();</div>
<div><br></div><div> merger->SetInput(i-1, labelMap);</div><div> }</div><div><br></div><div> merger->Update();</div><div> std::cout << "number of objects: " </div><div> << merger->GetOutput()->GetNumberOfLabelObjects() </div>
<div> << "\n";</div><div> std::cout << "number of expected objects: " << noObjects</div><div> << "\n";</div><div><br></div><div> return EXIT_SUCCESS;</div>
<div>}</div></div><div><br></div><div><br></div>