Skip to content
Snippets Groups Projects
Commit ce8f3e48 authored by Patrick Imbo's avatar Patrick Imbo
Browse files

FA 00010 et 00011

parent 2ba0e08b
No related branches found
No related tags found
No related merge requests found
...@@ -62,8 +62,9 @@ public: ...@@ -62,8 +62,9 @@ public:
typedef typename OutputImageType::ValueType OutputImageValueType; typedef typename OutputImageType::ValueType OutputImageValueType;
// itkSetMacro(PathValue, OutputImagePixelType); //OTB-FA-00011-CS
// itkGetConstReferenceMacro(PathValue, OutputImagePixelType); itkSetMacro(Value, OutputImagePixelType);
itkGetConstReferenceMacro(Value, OutputImagePixelType);
protected: protected:
DrawPathFilter(); DrawPathFilter();
...@@ -76,7 +77,7 @@ private: ...@@ -76,7 +77,7 @@ private:
DrawPathFilter(const Self&); //purposely not implemented DrawPathFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented
OutputImagePixelType m_PathValue; OutputImagePixelType m_Value;
......
...@@ -30,7 +30,8 @@ template <class TInputImage, class TInputPath,class TOutputImage> ...@@ -30,7 +30,8 @@ template <class TInputImage, class TInputPath,class TOutputImage>
DrawPathFilter<TInputImage,TInputPath,TOutputImage> DrawPathFilter<TInputImage,TInputPath,TOutputImage>
::DrawPathFilter() ::DrawPathFilter()
{ {
m_PathValue = static_cast<OutputImagePixelType>(250.0); //OTB-FA-00011-CS
m_Value = static_cast<OutputImagePixelType>(250.0);
} }
...@@ -110,7 +111,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage> ...@@ -110,7 +111,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage>
IndexOut[1] = static_cast<int>(Alpha * (j-x1) + y1) ; IndexOut[1] = static_cast<int>(Alpha * (j-x1) + y1) ;
if(IndexOut[0]>=0 && IndexOut[0]<Taille[0] && if(IndexOut[0]>=0 && IndexOut[0]<Taille[0] &&
IndexOut[1]>=0 && IndexOut[1]<Taille[1]) IndexOut[1]>=0 && IndexOut[1]<Taille[1])
OutputImage->SetPixel(IndexOut,m_PathValue); //OTB-FA-00010-CS
OutputImage->SetPixel(IndexOut,m_Value);
} }
} }
else else
...@@ -122,7 +124,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage> ...@@ -122,7 +124,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage>
IndexOut[1] = static_cast<int>(j); IndexOut[1] = static_cast<int>(j);
if(IndexOut[0]>=0 && IndexOut[0]<Taille[0] && if(IndexOut[0]>=0 && IndexOut[0]<Taille[0] &&
IndexOut[1]>=0 && IndexOut[1]<Taille[1]) IndexOut[1]>=0 && IndexOut[1]<Taille[1])
OutputImage->SetPixel(IndexOut,m_PathValue); //OTB-FA-00010-CS
OutputImage->SetPixel(IndexOut,m_Value);
} }
} }
...@@ -137,7 +140,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage> ...@@ -137,7 +140,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage>
IndexOut[0]=static_cast<int>(j); IndexOut[0]=static_cast<int>(j);
if(IndexOut[0]>=0 && IndexOut[0]<Taille[0] && if(IndexOut[0]>=0 && IndexOut[0]<Taille[0] &&
IndexOut[1]>=0 && IndexOut[1]<Taille[1]) IndexOut[1]>=0 && IndexOut[1]<Taille[1])
OutputImage->SetPixel(IndexOut,m_PathValue); //OTB-FA-00010-CS
OutputImage->SetPixel(IndexOut,m_Value);
} }
} }
...@@ -150,7 +154,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage> ...@@ -150,7 +154,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage>
IndexOut[1]=static_cast<int>(j); IndexOut[1]=static_cast<int>(j);
if( (IndexOut[0]>=0) && (IndexOut[0]<Taille[0]) && if( (IndexOut[0]>=0) && (IndexOut[0]<Taille[0]) &&
(IndexOut[1]>=0) && (IndexOut[1]<Taille[1])) (IndexOut[1]>=0) && (IndexOut[1]<Taille[1]))
OutputImage->SetPixel(IndexOut,m_PathValue); //OTB-FA-00010-CS
OutputImage->SetPixel(IndexOut,m_Value);
} }
} }
} }
...@@ -168,7 +173,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage> ...@@ -168,7 +173,8 @@ DrawPathFilter<TInputImage,TInputPath,TOutputImage>
::PrintSelf(std::ostream& os, itk::Indent indent) const ::PrintSelf(std::ostream& os, itk::Indent indent) const
{ {
Superclass::PrintSelf(os, indent); Superclass::PrintSelf(os, indent);
os << indent << "Path Value: " << m_PathValue << std::endl; //OTB-FA-00010-CS
os << indent << "Path Value: " << m_Value << std::endl;
} }
......
...@@ -57,8 +57,9 @@ public: ...@@ -57,8 +57,9 @@ public:
TInputImage::ImageDimension); TInputImage::ImageDimension);
/** Set/Get the image input of this process object. */ /** Set/Get the image input of this process object. */
virtual void SetImageInput( const InputImageType * image); //OTB-FA-00010-CS
const InputImageType * GetImageInput(void); virtual void SetInput( const InputImageType * image);
const InputImageType * GetInput(void);
protected: protected:
ImageToPathListFilter(); ImageToPathListFilter();
......
...@@ -36,7 +36,8 @@ ImageToPathListFilter<TInputImage,TOutputPath> ...@@ -36,7 +36,8 @@ ImageToPathListFilter<TInputImage,TOutputPath>
template <class TInputImage, class TOutputPath> template <class TInputImage, class TOutputPath>
void void
ImageToPathListFilter<TInputImage,TOutputPath> ImageToPathListFilter<TInputImage,TOutputPath>
::SetImageInput(const InputImageType *image) //OTB-FA-00010-CS
::SetInput(const InputImageType *image)
{ {
// We have 1 input: an image // We have 1 input: an image
...@@ -48,7 +49,8 @@ ImageToPathListFilter<TInputImage,TOutputPath> ...@@ -48,7 +49,8 @@ ImageToPathListFilter<TInputImage,TOutputPath>
template <class TInputImage, class TOutputPath> template <class TInputImage, class TOutputPath>
const typename ImageToPathListFilter<TInputImage,TOutputPath>::InputImageType * const typename ImageToPathListFilter<TInputImage,TOutputPath>::InputImageType *
ImageToPathListFilter<TInputImage,TOutputPath> ImageToPathListFilter<TInputImage,TOutputPath>
::GetImageInput(void) //OTB-FA-00010-CS
::GetInput(void)
{ {
if (this->GetNumberOfInputs() < 1) if (this->GetNumberOfInputs() < 1)
{ {
......
...@@ -117,7 +117,6 @@ protected: ...@@ -117,7 +117,6 @@ protected:
virtual void GenerateOutputInformation(){}; // do nothing virtual void GenerateOutputInformation(){}; // do nothing
virtual void GenerateData(); virtual void GenerateData();
virtual std::vector<double> tab(int n,double p,double m); virtual std::vector<double> tab(int n,double p,double m);
// virtual void AngleCalculate(InputImageConstPointer ImageIn,RealImagePointer ImageOut);
virtual void AngleCalculate( const InputImageType* InputImageIn,RealImageTypePointer AngleImage); virtual void AngleCalculate( const InputImageType* InputImageIn,RealImageTypePointer AngleImage);
SizeType m_Size; SizeType m_Size;
......
...@@ -325,7 +325,8 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath> ...@@ -325,7 +325,8 @@ ImageToPathListAlignFilter<TInputImage,TOutputPath>
// Get the input and output pointers // Get the input and output pointers
const InputImageType * InputImage = this->GetImageInput(); //OTB-FA-00010-CS
const InputImageType * InputImage = this->GetInput();
OutputPathListType * OutputPath = this->GetOutput(); OutputPathListType * OutputPath = this->GetOutput();
// Generate the image // Generate the image
......
...@@ -42,27 +42,16 @@ int otbAlignImageToPath( int argc, char ** argv ) ...@@ -42,27 +42,16 @@ int otbAlignImageToPath( int argc, char ** argv )
typedef unsigned char InputPixelType; typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType; typedef unsigned char OutputPixelType;
// typedef float PathType;
typedef float RealPixelType; typedef float RealPixelType;
const unsigned int Dimension = 2; const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType; typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< RealPixelType, Dimension > RealImageType; typedef itk::Image< RealPixelType, Dimension > RealImageType;
// typedef itk::Path< double, itk::ContinuousIndex< double , Dimension > , Dimension > PathType; typedef itk::PolyLineParametricPath< Dimension > PathType;
typedef itk::PolyLineParametricPath< Dimension > PathType;
// typedef itk::ParametricPath< Dimension > PathType;
typedef PathType::Pointer PathTypePointer; typedef PathType::Pointer PathTypePointer;
// PathType ltoto;
PathType::Pointer ltoto = PathType::New(); PathType::Pointer ltoto = PathType::New();
/* typedef otb::ImageToPathAlignExtract<itk::Image< InputPixelType, Dimension > ,PathType> OutputPathType;
typedef OutputPathType::InputImageType InputImageType;
*/
// typedef otb::PathListSource<PathType> PathListSourceType;
// PathListSourceType::Pointer PathSourceList = PathListSourceType::New();
typedef itk::Image< OutputPixelType, Dimension > OutputImageType; typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
...@@ -74,17 +63,14 @@ int otbAlignImageToPath( int argc, char ** argv ) ...@@ -74,17 +63,14 @@ int otbAlignImageToPath( int argc, char ** argv )
ReaderType::Pointer reader = ReaderType::New(); ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New(); WriterType::Pointer writer = WriterType::New();
InputImageType::Pointer ImageIn = InputImageType::New(); InputImageType::Pointer ImageIn = InputImageType::New();
// ListAlignFilterType::Pointer Align = ListAlignFilterType::New();
// typedef itk::PathSource<PathType> TestType;
// TestType::Pointer test = TestType::New();
typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> TestType; typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> TestType;
TestType::Pointer testList = TestType::New(); TestType::Pointer testList = TestType::New();
reader->SetFileName( inputFilename ); reader->SetFileName( inputFilename );
testList->SetImageInput( reader->GetOutput() ); //OTB-FA-00010-CS
testList->SetInput( reader->GetOutput() );
typedef ListAlignFilterType::OutputPathListType ListAlignFilterOutputPathListType; typedef ListAlignFilterType::OutputPathListType ListAlignFilterOutputPathListType;
...@@ -101,13 +87,11 @@ int otbAlignImageToPath( int argc, char ** argv ) ...@@ -101,13 +87,11 @@ int otbAlignImageToPath( int argc, char ** argv )
fprintf(stderr,"Erreur dans l'ouverture du fichier"); fprintf(stderr,"Erreur dans l'ouverture du fichier");
exit(-1); exit(-1);
} }
// typename InputImageType::PointType PointType;
typedef itk::ContinuousIndex< double,2> VertexType; typedef itk::ContinuousIndex< double,2> VertexType;
typedef itk::VectorContainer< unsigned,VertexType > VertexListType; typedef itk::VectorContainer< unsigned,VertexType > VertexListType;
typedef VertexListType::ConstPointer VertexListTypePointer; typedef VertexListType::ConstPointer VertexListTypePointer;
VertexListTypePointer vertexList; VertexListTypePointer vertexList;
VertexType cindex; VertexType cindex;
// PointType::Pointer point;
double x1,y1,x2,y2; double x1,y1,x2,y2;
int nbPath = sortiePath->size(); int nbPath = sortiePath->size();
...@@ -140,9 +124,6 @@ int otbAlignImageToPath( int argc, char ** argv ) ...@@ -140,9 +124,6 @@ int otbAlignImageToPath( int argc, char ** argv )
std::cout << "Exception levee inconnue !" << std::endl; std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
// Software Guide : EndCodeSnippet
//#endif
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
......
...@@ -64,7 +64,9 @@ int otbDrawPathAlign( int argc, char ** argv ) ...@@ -64,7 +64,9 @@ int otbDrawPathAlign( int argc, char ** argv )
typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> PathListAlignType; typedef otb::ImageToPathListAlignFilter<InputImageType,PathType> PathListAlignType;
PathListAlignType::Pointer testList = PathListAlignType::New(); PathListAlignType::Pointer testList = PathListAlignType::New();
testList->SetImageInput( reader->GetOutput() );
//OTB-FA-00010-CS
testList->SetInput( reader->GetOutput() );
testList->Update(); testList->Update();
OutputPathListType * sortiePath = testList->GetOutput(); OutputPathListType * sortiePath = testList->GetOutput();
......
...@@ -229,12 +229,12 @@ int otbDrawPathList( int argc, char ** argv ) ...@@ -229,12 +229,12 @@ int otbDrawPathList( int argc, char ** argv )
reader->SetFileName( inputFilename ); reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename ); writer->SetFileName( outputFilename );
testList->SetImageInput( reader->GetOutput() ); //OTB-FA-00010-CS
testList->SetInput( reader->GetOutput() );
testList->Update(); testList->Update();
DrawPath->SetImageInput(reader->GetOutput() ); DrawPath->SetImageInput(reader->GetOutput() );
DrawPath->SetPathInput( testList->GetOutput()); DrawPath->SetPathInput( testList->GetOutput());
// DrawPath->SetImageOutput();
DrawPath->Update(); DrawPath->Update();
writer->SetInput(DrawPath->GetImageOutput()); writer->SetInput(DrawPath->GetImageOutput());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment