Commit fc5debec authored by Jordi Inglada's avatar Jordi Inglada

Passage des tests de learning en otbImage

parent 4c62d974
......@@ -184,8 +184,6 @@ int main( int argc, char* argv[] )
classifier->Update() ;
/* Build the class map */
std::cout << "Output image creation" << std::endl;
std::cout << "classifier get output" << std::endl;
ClassifierType::OutputType* membershipSample =
......
......@@ -26,7 +26,8 @@
#include "itkListSample.h"
#include "itkVectorImage.h"
#include "otbImage.h"
#include "otbVectorImage.h"
#include "itkImageToListAdaptor.h"
#include "otbSVMClassifier.h"
#include "otbImageFileReader.h"
......@@ -67,7 +68,7 @@ int otbSVMClassifierImage(int argc, char* argv[] )
typedef itk::Image< itk::FixedArray<InputPixelType,3>, Dimension > InputImageType;
typedef otb::Image< itk::FixedArray<InputPixelType,3>, Dimension > InputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
......@@ -82,66 +83,6 @@ int otbSVMClassifierImage(int argc, char* argv[] )
std::cout << "Image read" << std::endl;
/*
typedef itk::PointSet< InputVectorType, Dimension >
MeasurePointSetType;
MeasurePointSetType::Pointer mPSet = MeasurePointSetType::New();
typedef MeasurePointSetType::PointType MeasurePointType;
typedef MeasurePointSetType::PointsContainer MeasurePointsContainer;
MeasurePointsContainer::Pointer mCont = MeasurePointsContainer::New();
typedef itk::ImageRegionIterator< InputImageType> InputIteratorType;
InputIteratorType inIt( reader->GetOutput(),
reader->GetOutput()->GetBufferedRegion() );
inIt.GoToBegin();
std::cout << "Building the pointset" << std::endl;
unsigned long pointId=0;
while(!inIt.IsAtEnd() )
{
MeasurePointType mP;
mP[0] = inIt.GetIndex()[0];
mP[1] = inIt.GetIndex()[1];
InputVectorType measure;
measure.push_back(inIt.Get()[0]);
measure.push_back(inIt.Get()[1]);
measure.push_back(inIt.Get()[2]);
mCont->InsertElement( pointId , mP );
mPSet->SetPointData( pointId, measure );
++inIt;
++pointId;
}
std::cout << "Set the points" << std::endl;
mPSet->SetPoints( mCont );
std::cout << "PointSet built" << std::endl;
typedef itk::Statistics::PointSetToListAdaptor< MeasurePointSetType >
SampleType;
SampleType::Pointer sample = SampleType::New();
sample->SetPointSet( mPSet );
*/
typedef itk::Statistics::ImageToListAdaptor< InputImageType > SampleType;
SampleType::Pointer sample = SampleType::New();
......@@ -171,7 +112,7 @@ int otbSVMClassifierImage(int argc, char* argv[] )
std::cout << "Output image creation" << std::endl;
typedef ClassifierType::ClassLabelType OutputPixelType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::Image< OutputPixelType, Dimension > OutputImageType;
OutputImageType::Pointer outputImage = OutputImageType::New();
......@@ -223,7 +164,7 @@ int otbSVMClassifierImage(int argc, char* argv[] )
}
typedef itk::Image< unsigned char, Dimension > FileImageType;
typedef otb::Image< unsigned char, Dimension > FileImageType;
typedef itk::RescaleIntensityImageFilter< OutputImageType,
......
......@@ -113,7 +113,6 @@ int otbSVMClassifierPointSet(int argc, char* argv[] )
classifier->Update() ;
/* Build the class map */
std::cout << "Output image creation" << std::endl;
std::cout << "classifier get output" << std::endl;
......
......@@ -17,8 +17,8 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkVectorImage.h"
#include "otbImage.h"
#include "otbVectorImage.h"
#include <iostream>
#include "otbSVMImageModelEstimator.h"
......@@ -31,9 +31,9 @@ int otbSVMImageModelEstimatorNew( int argc, char* argv[] )
typedef double InputPixelType;
const unsigned int Dimension = 2;
typedef itk::VectorImage< InputPixelType, Dimension > InputImageType;
typedef otb::VectorImage< InputPixelType, Dimension > InputImageType;
typedef itk::Image< InputPixelType, Dimension > TrainingImageType;
typedef otb::Image< InputPixelType, Dimension > TrainingImageType;
typedef std::vector<double> VectorType;
......
......@@ -17,7 +17,8 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "otbImage.h"
#include "otbVectorImage.h"
#include <iostream>
#include "otbSVMImageModelEstimator.h"
......@@ -37,9 +38,9 @@ int otbSVMImageModelEstimatorTrain( int argc, char* argv[] )
typedef double InputPixelType;
const unsigned int Dimension = 2;
typedef itk::VectorImage< InputPixelType, Dimension > InputImageType;
typedef otb::VectorImage< InputPixelType, Dimension > InputImageType;
typedef itk::Image< InputPixelType, Dimension > TrainingImageType;
typedef otb::Image< InputPixelType, Dimension > TrainingImageType;
typedef std::vector<double> VectorType;
......
......@@ -17,7 +17,6 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include <iostream>
#include "otbSVMMembershipFunction.h"
......
......@@ -17,7 +17,6 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include <iostream>
#include "otbSVMMembershipFunction.h"
......
......@@ -17,7 +17,7 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "otbImage.h"
#include <iostream>
#include "otbSVMModel.h"
......@@ -31,7 +31,7 @@ int otbSVMModelAllocateProblem( int argc, char* argv[] )
typedef unsigned char LabelPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef otb::Image< InputPixelType, Dimension > InputImageType;
typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType;
......
......@@ -17,7 +17,7 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "otbImage.h"
#include <iostream>
#include "otbSVMModel.h"
......@@ -31,7 +31,7 @@ int otbSVMModelLoad( int argc, char* argv[] )
typedef unsigned char LabelPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef otb::Image< InputPixelType, Dimension > InputImageType;
typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType;
......
......@@ -17,7 +17,7 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "otbImage.h"
#include <iostream>
#include "otbSVMModel.h"
......@@ -31,7 +31,7 @@ int otbSVMModelLoadSave( int argc, char* argv[] )
typedef unsigned char LabelPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef otb::Image< InputPixelType, Dimension > InputImageType;
typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType;
......
......@@ -17,7 +17,7 @@
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "otbImage.h"
#include <iostream>
#include "otbSVMModel.h"
......@@ -31,7 +31,7 @@ int otbSVMModelNew( int argc, char* argv[] )
typedef unsigned char LabelPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef otb::Image< InputPixelType, Dimension > InputImageType;
typedef otb::SVMModel< InputPixelType, LabelPixelType > ModelType;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment