static void CreateImage(ImageType* const image);
int main(int argc, char *argv[])
{
ImageType::Pointer image;
if(argc < 2)
{
image = ImageType::New();
CreateImage(image);
}
else
{
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
image = reader->GetOutput();
}
RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();
rescaleFilter->SetInput(image);
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetOutputMaximum(255);
rescaleFilter->Update();
viewer.
AddImage(rescaleFilter->GetOutput());
return EXIT_SUCCESS;
}
void CreateImage(ImageType* const image)
{
unsigned int NumRows = 200;
unsigned int NumCols = 300;
size[0] = NumRows;
size[1] = NumCols;
image->SetRegions(region);
image->Allocate();
for(unsigned int r = 40; r < 100; r++)
{
for(unsigned int c = 40; c < 100; c++)
{
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 15);
}
}
}