int
main(int argc, char * argv[])
{
 
  if (argc < 7)
  {
    std::cerr << "Missing Parameters." << std::endl;
    std::cerr << "Usage: " << argv[0] << " inputImage outputImage"
              << " seedX seedY"
              << " lowerThreshold upperThreshold" << std::endl;
    return EXIT_FAILURE;
  }
 
 
  
  
  
  
  
  
  
 
  
  using InternalPixelType = float;
  constexpr unsigned int Dimension = 2;
  
 
 
  using OutputPixelType = unsigned char;
 
  using CastingFilterType =
  auto caster = CastingFilterType::New();
 
 
  
  
 
 
  
  
  
  
  
  
 
  
  using CurvatureFlowImageFilterType =
  
 
 
  
  
  
  
  
  
 
  
  auto smoothing = CurvatureFlowImageFilterType::New();
  
 
 
  
  
  
  
  
  
 
  
  using ConnectedFilterType =
                                          InternalImageType>;
  
 
  
  
  
  
  
 
  
  auto neighborhoodConnected = ConnectedFilterType::New();
  
 
 
  
  
  
  
  
  
  
  
  
 
  
  smoothing->SetInput(input);
  neighborhoodConnected->SetInput(smoothing->GetOutput());
  caster->SetInput(neighborhoodConnected->GetOutput());
  
 
 
  
  
  
  
  
  
  
  
 
  
  smoothing->SetNumberOfIterations(5);
  smoothing->SetTimeStep(0.125);
  
 
 
  
  
  
  
  
  
  
  
  
  
  
  
  
 
  const InternalPixelType lowerThreshold = std::stod(argv[5]);
  const InternalPixelType upperThreshold = std::stod(argv[6]);
 
  
  neighborhoodConnected->SetLower(lowerThreshold);
  neighborhoodConnected->SetUpper(upperThreshold);
  
 
  
  
  
  
  
  
  
  
  
  
 
  
  InternalImageType::SizeType radius;
 
  radius[0] = 2; 
  radius[1] = 2; 
 
  neighborhoodConnected->SetRadius(radius);
  
 
 
  
  
  
  
  
  
  
  
  
  
 
  InternalImageType::IndexType index;
 
  index[0] = std::stoi(argv[3]);
  index[1] = std::stoi(argv[4]);
 
 
  
  neighborhoodConnected->SetSeed(index);
  neighborhoodConnected->SetReplaceValue(255);
  
 
 
  
  
  
  
  
  
  
 
  
  try
  {
  }
  {
    std::cerr << "Exception caught !" << std::endl;
    std::cerr << excep << std::endl;
  }
  
 
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
  return EXIT_SUCCESS;
}
Casts input pixels to output pixel type.
 
Denoise an image using curvature driven flow.
 
Standard exception handling object.
 
Templated n-dimensional image class.
 
Label pixels that are connected to a seed and lie within a neighborhood.
 
ITK_TEMPLATE_EXPORT void WriteImage(TImagePointer &&image, const std::string &filename, bool compress=false)
 
TOutputImage::Pointer ReadImage(const std::string &filename)