#include "itksys/SystemTools.hxx"
#ifdef ENABLE_QUICKVIEW
#endif
static void
int
main(int argc, char * argv[])
{
std::stringstream desc;
if (argc > 1)
{
image = itk::ReadImage<ImageType>(argv[1]);
if (argc > 2)
{
cropSize[0] = std::stoi(argv[2]);
cropSize[1] = std::stoi(argv[3]);
}
desc << itksys::SystemTools::GetFilenameName(argv[1]);
}
else
{
CreateImage(image);
cropSize[0] = 10;
cropSize[1] = 14;
desc << "Synthetic image";
}
cropFilter->SetInput(image);
cropFilter->SetBoundaryCropSize(cropSize);
#ifdef ENABLE_QUICKVIEW
viewer.
AddRGBImage(image.GetPointer(),
true, desc.str());
std::stringstream desc2;
desc2 << "CropImageFilter, crop size = {" << cropSize[0] << ", " << cropSize[1] << "}";
viewer.
AddRGBImage(cropFilter->GetOutput(),
true, desc2.str());
#endif
return EXIT_SUCCESS;
}
void
{
start[0] = 0;
start[1] = 0;
unsigned int NumRows = 200;
unsigned int NumCols = 300;
size[0] = NumRows;
size[1] = NumCols;
region.SetIndex(start);
image->SetRegions(region);
image->Allocate();
PixelType rgbPixel;
rgbPixel[0] = 200;
rgbPixel[1] = 200;
rgbPixel[2] = 200;
for (unsigned int r = 20; r < 180; ++r)
{
for (unsigned int c = 30; c < 270; ++c)
{
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, rgbPixel);
}
}
}