int main( int argc, char *argv[])
{
FloatImageType::Pointer image = FloatImageType::New();
image->SetRegions(region);
image->Allocate();
for(unsigned int i = 0; i < size[0]; i++)
{
for(unsigned int j = 0; j < size[1]; j++)
{
pixel[0] = i;
pixel[1] = j;
image->SetPixel(pixel, i);
}
}
ColormapType::ChannelType redChannel;
ColormapType::ChannelType greenChannel;
ColormapType::ChannelType blueChannel;
redChannel.push_back(static_cast<ColormapType::RealType>(0.231373));
greenChannel.push_back(static_cast<ColormapType::RealType>(0.298039));
blueChannel.push_back(static_cast<ColormapType::RealType>(0.752941));
redChannel.push_back(static_cast<ColormapType::RealType>(1));
greenChannel.push_back(static_cast<ColormapType::RealType>(1));
blueChannel.push_back(static_cast<ColormapType::RealType>(1));
redChannel.push_back(static_cast<ColormapType::RealType>(0.705882));
greenChannel.push_back(static_cast<ColormapType::RealType>(0.0156863));
blueChannel.push_back(static_cast<ColormapType::RealType>(0.14902));
ColormapType::Pointer colormap = ColormapType::New();
colormap->SetRedChannel(redChannel);
colormap->SetGreenChannel(greenChannel);
colormap->SetBlueChannel(blueChannel);
RGBFilterType::Pointer rgbfilter = RGBFilterType::New();
rgbfilter->SetInput(image);
rgbfilter->SetColormap(colormap);
{
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("colormap.png");
writer->SetInput(rgbfilter->GetOutput());
writer->Update();
}
return EXIT_SUCCESS;
}