#if defined(_MSC_VER)
# pragma warning(disable : 4786)
#endif
int
main(int argc, char * argv[])
{
if (argc < 7)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage outputImage lowerThreshold upperThreshold "
"seedX seedY [seed2X seed2Y ... ]"
<< std::endl;
return 1;
}
const unsigned int Dimension = 2;
using InternalPixelType = float;
{
std::cerr << "Input image is not a " << Dimension << " dimensional image as expected!" << std::endl;
return 1;
}
InternalImageType::Pointer itkImage =
dynamic_cast<InternalImageType *
>(image.
GetITKBase());
if (itkImage.IsNull())
{
std::cerr << "Unexpected error converting SimpleITK image to ITK image!" << std::endl;
return 1;
}
BlurFilterType::Pointer blurFilter = BlurFilterType::New();
blurFilter->SetInput(itkImage);
blurFilter->SetNumberOfIterations(5);
blurFilter->SetTimeStep(0.125);
blurFilter->Update();
segmentationFilter.
SetLower(atof(argv[3]));
segmentationFilter.
SetUpper(atof(argv[4]));
for (int i = 5; i + 1 < argc; i += 2)
{
std::vector<unsigned int> seed = { (unsigned int)atoi(argv[i]), (unsigned int)atoi(argv[i + 1]) };
std::cout << "Adding a seed at ";
for (unsigned int j = 0; j < seed.size(); ++i)
{
std::cout << seed[j] << " ";
}
std::cout << std::endl;
}
return 0;
}
A hybrid cast image filter to convert images to other types of images.
Self & SetOutputPixelType(PixelIDValueEnum pixelID)
Image Execute(const Image &)
Label pixels that are connected to a seed and lie within a range of values.
Self & AddSeed(std::vector< unsigned int > point)
Add SeedList point.
Self & SetUpper(double Upper)
Self & SetLower(double Lower)
Image Execute(const Image &image1)
Self & SetReplaceValue(uint8_t ReplaceValue)
Read an image file and return a SimpleITK Image.
Image Execute() override
Set/Get The output PixelType of the image.
Self & SetFileName(const PathType &fn)
Write out a SimpleITK image to the specified file location.
Self & SetFileName(const PathType &fileName)
Self & Execute(const Image &)
The Image class for SimpleITK.
unsigned int GetDimension() const
itk::DataObject * GetITKBase()