写位图
typedef itk::Image<unsigned char, 2> UnsignedCharImageType;
typedef itk::CastImageFilter< ImageType, UnsignedCharImageType> CastFilterType;
CastFilterType::Pointer castFilter = CastFilterType::New();
castFilter->SetInput(flipFilter->GetOutput());
castFilter->Update();
//cout<<"获得灰度区间"<<endl;
typedef itk::StatisticsImageFilter<ImageType> StatisticsImageFilterType;
StatisticsImageFilterType::Pointer statisticsImageFilter = StatisticsImageFilterType::New ();
statisticsImageFilter->SetInput(castFilter->GetOutput());
statisticsImageFilter->Update();
signed int pRange[2]; //这里会有负值
pRange[0] = statisticsImageFilter->GetMinimum();
pRange[1] = statisticsImageFilter->GetMaximum();
std::cout<<"pRange[0] "<<pRange[0]<<endl;
std::cout<<"pRange[1]"<<pRange[1]<<endl;
typedef itk::ImageFileWriter< UnsignedCharImageType > CharWriterType;
CharWriterType::Pointer writer0 = CharWriterType::New();
writer0->SetFileName("D:\\img\\333result.png");
writer0->SetInput(castFilter->GetOutput());
writer0->Update();