I have used the itk::ConnectedComponentImageFilter. For each slice I have a certain number of connected component. I want to obtain a label associated to each of these ones, but with the following code I obtain only one label for each slice.
using ConnectedComponentImageFilterType = itk::ConnectedComponentImageFilter<ImageTypeUC, ImageTypeUC, ImageTypeUC>;
ConnectedComponentImageFilterType::Pointer connesso= ConnectedComponentImageFilterType::New();
connesso->SetInput(ITKIMAGE);
connesso->GetFullyConnected();
connesso->GetObjectCount();
connesso->Update();
connesso->GetOutput();
cout << "Number of connected components: " << connesso->GetObjectCount() << ‘\t’;
cout << "Labels associated: " << connesso->GetOutput() << ‘\t’;