ITK/Examples/QuickViewDemo
From KitwarePublic
Jump to navigationJump to search
QuickViewDemo.cxx
<source lang="cpp">
- include "itkImage.h"
- include "itkImageFileReader.h"
- include "itkRescaleIntensityImageFilter.h"
- include "QuickView.h"
int main(int argc, char *argv[]) {
if(argc < 2) { std::cerr << "Required: filename" << std::endl; return EXIT_FAILURE; }
typedef itk::Image<unsigned char, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]);
typedef itk::RescaleIntensityImageFilter< ImageType, ImageType > RescaleFilterType; RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New(); rescaleFilter->SetInput(reader->GetOutput()); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255);
QuickView viewer; viewer.AddImage(reader->GetOutput()); viewer.AddImage(rescaleFilter->GetOutput()); viewer.Visualize();
return EXIT_SUCCESS;
} </source>
CMakeLists.txt
<source lang="cmake">
</source>