int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " visibleHumanPath outputImageFile" << std::endl;
return EXIT_FAILURE;
}
std::string visibleHumanPath = argv[1];
std::string outputImageFile = argv[2];
using PixelType = unsigned char;
nameGenerator->SetSeriesFormat(visibleHumanPath + "a_vm%04d.raw");
nameGenerator->SetStartIndex(1001);
nameGenerator->SetEndIndex(2878);
nameGenerator->SetIncrementIndex(1);
rimageio->SetDimensions(0, 2048);
rimageio->SetDimensions(1, 1216);
rimageio->SetSpacing(0, .33);
rimageio->SetSpacing(1, .33);
rimageio->SetHeaderSize(rimageio->GetImageSizeInPixels() * 0);
gimageio->SetDimensions(0, 2048);
gimageio->SetDimensions(1, 1216);
gimageio->SetSpacing(0, .33);
gimageio->SetSpacing(1, .33);
gimageio->SetHeaderSize(gimageio->GetImageSizeInPixels() * 1);
bimageio->SetDimensions(0, 2048);
bimageio->SetDimensions(1, 1216);
bimageio->SetSpacing(0, .33);
bimageio->SetSpacing(1, .33);
bimageio->SetHeaderSize(bimageio->GetImageSizeInPixels() * 2);
rreader->SetFileNames(nameGenerator->GetFileNames());
rreader->SetImageIO(rimageio);
greader->SetFileNames(nameGenerator->GetFileNames());
greader->SetImageIO(gimageio);
breader->SetFileNames(nameGenerator->GetFileNames());
breader->SetImageIO(bimageio);
using ComposeRGBFilterType =
composeRGB->SetInput1(rreader->GetOutput());
composeRGB->SetInput2(greader->GetOutput());
composeRGB->SetInput3(breader->GetOutput());
composeRGB->UpdateOutputInformation();
composeRGB->GetOutput()->GetLargestPossibleRegion();
coronalSlice.SetSize(1, 0);
using ExtractFilterType =
extract->SetDirectionCollapseToIdentity();
extract->InPlaceOn();
extract->SetInput(composeRGB->GetOutput());
extract->SetExtractionRegion(coronalSlice);
writer->SetFileName(outputImageFile);
writer->SetNumberOfStreamDivisions(200);
writer->SetInput(extract->GetOutput());
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;
}