Hi,
I’m trying to refactor some code in a function. The function is:
ITKImgLabelType2D::Pointer GetLabelImageFilter(const ITKImgLabelType2D::Pointer& labelMap)
{
using LabelMapToLabelImageFilterType = itk::LabelMapToLabelImageFilter<BinaryImageToShapeLabelMapFilterType::OutputImageType, ITKImgLabelType2D>;
auto labelMapToLabelImageFilter = LabelMapToLabelImageFilterType::New();
labelMapToLabelImageFilter->SetInput(labelMap->GetOutput());
try {
labelMapToLabelImageFilter->Update();
}
catch (const itk::ExceptionObject& err) {
file1 << "ExceptionObject caught !" << __func__ << std::endl;
file1 << err.what() << std::endl;
}
WriteImage(labelMapToLabelImageFilter->GetOutput(), "labelMapToLabelImageFilter.jpg", file1);
return labelMapToLabelImageFilter->GetOutput();
}
where ITKImgLabelType2D = itk::Image<unsigned char,2>
When I call this function from main() I don’t know why but I don’t get back anything, the execution never goes out of the function, it stays forever in the return statement.
Has anyone any idea of which could be the error?
Thank you so much for your time!
Cristina Montserrat