Você está na página 1de 1

#include <iostream> #include "itkImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkBinaryThresholdImageFilter.

h" int main( int , char * argv[]) { typedef unsigned char TPixel; const unsigned int dimension = 2; typedef itk::Image<TPixel,dimension> TImagen; typedef itk::ImageFileReader<TImagen> TLector; typedef itk::ImageFileWriter<TImagen> TEscritor; typedef itk::BinaryThresholdImageFilter<TImagen,TImagen> TFiltroUmbral; TLector::Pointer lector=TLector::New(); TEscritor::Pointer escritor=TEscritor::New(); TFiltroUmbral::Pointer filtroUmbral=TFiltroUmbral::New(); filtroUmbral->SetInput(lector->GetOutput()); escritor->SetInput(filtroUmbral->GetOutput()); lector->SetFileName("C:\\EjemplosITK\\Caso3\\Lab3_img1.png"); escritor->SetFileName("C:\\EjemplosITK\\Caso3\\Lab3_img2.png"); filtroUmbral->SetInsideValue(255); filtroUmbral->SetOutsideValue(0); unsigned short minimo,maximo; std::cout<<"Ingrese los valores minimo y mximo de umbral:"; std::cin>>minimo>>maximo; filtroUmbral->SetLowerThreshold(minimo); filtroUmbral->SetUpperThreshold(maximo); try{ escritor->Update(); }catch( itk::ExceptionObject & excep ) { std::cerr << "Exception caught !" << std::endl; std::cerr << excep << std::endl; } return 0; }

Você também pode gostar