Skip to content
Snippets Groups Projects
Commit f5dd3fde authored by Julien Michel's avatar Julien Michel
Browse files

Correction du filtre : plus InPlace car trop de pb

parent 25080c1d
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ PURPOSE. See the above copyright notices for more information.
#ifndef _otbImportGeoInformationImageFilter_h
#define _otbImportGeoInformationImageFilter_h
#include "itkInPlaceImageFilter.h"
#include "itkCastImageFilter.h"
namespace otb
{
......@@ -36,12 +36,12 @@ namespace otb
*/
template <class TImage, class TSourceImage>
class ITK_EXPORT ImportGeoInformationImageFilter
: public itk::InPlaceImageFilter<TImage,TImage>
: public itk::CastImageFilter<TImage,TImage>
{
public:
/** Standard typedefs */
typedef ImportGeoInformationImageFilter Self;
typedef itk::InPlaceImageFilter<TImage,TImage> Superclass;
typedef itk::CastImageFilter<TImage,TImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -49,7 +49,7 @@ class ITK_EXPORT ImportGeoInformationImageFilter
itkNewMacro(Self);
/** Creation through object factory macro */
itkTypeMacro(ImportGeoInformationImageFilter, InPlaceImageFilter);
itkTypeMacro(ImportGeoInformationImageFilter, CastImageFilter);
/** Template parameters typedefs */
typedef TImage ImageType;
......@@ -76,12 +76,12 @@ protected:
virtual ~ImportGeoInformationImageFilter() {};
/**PrintSelf method */
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
/** GenerateData */
virtual void GenerateData(void);
/** Generate input requested region */
virtual void GenerateInputRequestedRegion(void);
/** Generate output information */
virtual void GenerateOutputInformation(void);
/* /\** Generate data *\/ */
/* virtual void GenerateData(void); */
private:
ImportGeoInformationImageFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
......
......@@ -34,8 +34,6 @@ ImportGeoInformationImageFilter<TImage,TSourceImage>
::ImportGeoInformationImageFilter()
{
this->SetNumberOfRequiredInputs(2);
this->SetNthInput(1,SourceImageType::New().GetPointer());
this->SetInPlace(true);
}
template <class TImage, class TSourceImage>
......@@ -84,17 +82,25 @@ void
SourceImageType * sourcePtr =const_cast<SourceImageType *>(this->GetSource());
// Import metdata
outputPtr->CopyInformation(sourcePtr);
outputPtr->SetLargestPossibleRegion(this->GetInput()->GetLargestPossibleRegion());
}
/**
* Main computation method.
*/
template <class TImage, class TSourceImage>
void
ImportGeoInformationImageFilter<TImage,TSourceImage>
::GenerateData(void)
{
this->AllocateOutputs();
}
// template <class TImage, class TSourceImage>
// void
// ImportGeoInformationImageFilter<TImage,TSourceImage>
// ::GenerateData(void)
// {
// // Get output and source pointer
// ImagePointerType outputPtr = this->GetOutput();
// SourceImageType * sourcePtr =const_cast<SourceImageType *>(this->GetSource());
// // Import metdata
// outputPtr->CopyInformation(sourcePtr);
// // Don't forget to copy also the origin and spacing, not handled by the CopyInformation method.
// outputPtr->SetOrigin(sourcePtr->GetOrigin());
// outputPtr->SetSpacing(sourcePtr->GetSpacing());
// }
/**
* PrintSelf Method
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment