#include <cstdio>
#include <iomanip>
int main( int argc, char * argv[] )
{
if( argc < 4 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFileBase numberOfSlices" << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = float;
using OutputPixelType = float;
InputImageType, OutputImageType >;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
FilterType::Pointer laplacian = FilterType::New();
laplacian->SetNormalizeAcrossScale( true );
laplacian->SetInput( reader->GetOutput() );
WriterType::Pointer writer = WriterType::New();
writer->SetInput( laplacian->GetOutput() );
int numberOfSlices = std::stoi(argv[3]);
for( int slice=0; slice < numberOfSlices; slice++ )
{
std::ostringstream filename;
filename << argv[2]
<< std::setfill('0') << std::setw(3) << slice
<< ".mhd";
writer->SetFileName( filename.str() );
const float sigma = static_cast< float >( slice ) / 10.0 + 1.0;
laplacian->SetSigma( sigma );
writer->Update();
}
return EXIT_SUCCESS;
}