//--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ template<class ImageType>
+ int GetNumberOfConnectedComponentLabels(typename ImageType::Pointer input,
+ typename ImageType::PixelType BG,
+ bool isFullyConnected);
+ //--------------------------------------------------------------------
+
+
//--------------------------------------------------------------------
template<class TImageType>
typename TImageType::Pointer
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+template<class ImageType>
+int clitk::GetNumberOfConnectedComponentLabels(typename ImageType::Pointer input,
+ typename ImageType::PixelType BG,
+ bool isFullyConnected) {
+ // Connected Component label
+ typedef itk::ConnectedComponentImageFilter<ImageType, ImageType> ConnectFilterType;
+ typename ConnectFilterType::Pointer connectFilter = ConnectFilterType::New();
+ connectFilter->SetInput(input);
+ connectFilter->SetBackgroundValue(BG);
+ connectFilter->SetFullyConnected(isFullyConnected);
+ connectFilter->Update();
+
+ // Return result
+ return connectFilter->GetObjectCount();
+}
+//--------------------------------------------------------------------
+
//--------------------------------------------------------------------
template<class ImageType>
typename ImageType::Pointer