int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImageFile outputImageFile" << std::endl;
return EXIT_FAILURE;
}
std::string inputImageFile = argv[1];
std::string outputImageFile = argv[2];
reader->SetFileName(inputImageFile);
using GradientMagnitudeImageFilter =
grad->SetInput(reader->GetOutput());
grad->UseImageSpacingOn();
using GradientMagnitudeOutputImageType =
GradientMagnitudeImageFilter::OutputImageType;
using ComposeRGBFilterType =
composeRGB->SetInput1(grad->GetOutput());
composeRGB->SetInput2(grad->GetOutput());
composeRGB->SetInput3(grad->GetOutput());
composeRGB->UpdateOutputInformation();
composeRGB->GetOutput()->GetLargestPossibleRegion();
largest.GetIndex(0) +
static_cast<unsigned long>(0.25 * largest.GetSize(0)));
largest.GetIndex(1) +
static_cast<unsigned long>(0.25 * largest.GetSize(1)));
halfIO.
SetSize(0,
static_cast<unsigned long>(0.5 * largest.GetSize(0)));
halfIO.
SetSize(1,
static_cast<unsigned long>(0.5 * largest.GetSize(1)));
using ToVectorImageAdaptorType =
adaptor->SetImage(composeRGB->GetOutput());
writer->SetFileName(outputImageFile);
writer->SetNumberOfStreamDivisions(10);
writer->SetIORegion(halfIO);
writer->SetInput(adaptor);
try
{
writer->Update();
}
catch (const itk::ExceptionObject & err)
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
ComposeImageFilter combine several scalar images into a multicomponent image.
Data source that reads image data from a single file.
Writes image data to a single file.
An ImageIORegion represents a structured region of data.
void SetIndex(const IndexType &index)
void SetSize(const SizeType &size)
Templated n-dimensional image class.
Represent Red, Green and Blue components for color images.
Presents an image of pixel type RGBPixel as being and image of Vectors.
Simple mechanism for monitoring the pipeline events of a filter and reporting these events to std::co...
Computes a scalar, gradient magnitude image from a multiple channel (pixels are vectors) input.
ImageBaseType::RegionType RegionType