int
main(int argc, char * argv[])
{
if (argc < 5)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile lower upper "
<< std::endl;
return EXIT_FAILURE;
}
using InputPixelType = unsigned short;
using InternalPixelType = float;
reader->SetFileName(argv[1]);
try
{
reader->Update();
}
{
std::cerr << "Exception caught!" << std::endl;
std::cerr << excep << std::endl;
}
using IntensityFilterType =
intensityWindowing->SetWindowMinimum(std::stoi(argv[3]));
intensityWindowing->SetWindowMaximum(std::stoi(argv[4]));
intensityWindowing->SetOutputMinimum(0.0);
intensityWindowing->SetOutputMaximum(
255.0);
intensityWindowing->SetInput(reader->GetOutput());
using GaussianFilterType =
smootherX->SetInput(intensityWindowing->GetOutput());
smootherY->SetInput(smootherX->GetOutput());
const InputImageType::SpacingType & inputSpacing = inputImage->GetSpacing();
const double isoSpacing = std::sqrt(inputSpacing[2] * inputSpacing[0]);
smootherX->SetSigma(isoSpacing);
smootherY->SetSigma(isoSpacing);
smootherX->SetDirection(0);
smootherY->SetDirection(1);
using OutputPixelType = unsigned char;
using ResampleFilterType =
transform->SetIdentity();
resampler->SetTransform(transform);
using InterpolatorType =
resampler->SetInterpolator(interpolator);
resampler->SetDefaultPixelValue(255);
OutputImageType::SpacingType spacing;
spacing[0] = isoSpacing;
spacing[1] = isoSpacing;
spacing[2] = isoSpacing;
resampler->SetOutputSpacing(spacing);
resampler->SetOutputOrigin(inputImage->GetOrigin());
resampler->SetOutputDirection(inputImage->GetDirection());
inputImage->GetLargestPossibleRegion().
GetSize();
const double dx = inputSize[0] * inputSpacing[0] / isoSpacing;
const double dy = inputSize[1] * inputSpacing[1] / isoSpacing;
const double dz = (inputSize[2] - 1) * inputSpacing[2] / isoSpacing;
resampler->SetSize(size);
resampler->SetInput(smootherY->GetOutput());
resampler->Update();
writer->SetFileName(argv[2]);
writer->SetInput(resampler->GetOutput());
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
return EXIT_SUCCESS;
}
Standard exception handling object.
Data source that reads image data from a single file.
Writes image data to a single file.
Templated n-dimensional image class.
Applies a linear transformation to the intensity levels of the input Image that are inside a user-def...
Linearly interpolate an image at specified positions.
Base class for computing IIR convolution with an approximation of a Gaussian kernel.
Resample an image via a coordinate transform.
SmartPointer< const Self > ConstPointer
constexpr unsigned int Dimension
ImageBaseType::SizeType SizeType
unsigned long SizeValueType
const SizeValueType * GetSize() const