Skip to content
Snippets Groups Projects
Commit da524dde authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

BUG: fixing prolate segfault

parent 2b99ff51
No related branches found
No related tags found
No related merge requests found
...@@ -100,12 +100,9 @@ public: ...@@ -100,12 +100,9 @@ public:
return m_Function; return m_Function;
} }
/** Delete tables.*/ /** Initialize tables: need to be call explicitely */
void ResetOffsetTable() const; virtual void Initialize();
/** Initialize used tables*/
void InitializeTables() const;
/** Fill the weight offset table*/
void FillWeightOffsetTable() const;
/** Weights normalization accessors*/ /** Weights normalization accessors*/
itkSetMacro(NormalizeWeight, bool); itkSetMacro(NormalizeWeight, bool);
...@@ -120,6 +117,13 @@ protected: ...@@ -120,6 +117,13 @@ protected:
* flag to false */ * flag to false */
virtual void Modified(void); virtual void Modified(void);
/** Delete tables.*/
virtual void ResetOffsetTable();
/** Initialize used tables*/
virtual void InitializeTables();
/** Fill the weight offset table*/
virtual void FillWeightOffsetTable();
private: private:
GenericInterpolateImageFunction(const Self&); //purposely not implemented GenericInterpolateImageFunction(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented
......
...@@ -48,7 +48,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction,TBoundaryCondition, TCoor ...@@ -48,7 +48,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction,TBoundaryCondition, TCoor
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep> template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep> GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::ResetOffsetTable() const ::ResetOffsetTable()
{ {
// Clear the offset table // Clear the offset table
if (m_OffsetTable!=NULL) if (m_OffsetTable!=NULL)
...@@ -109,7 +109,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo ...@@ -109,7 +109,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep> template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep> GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::InitializeTables() const ::InitializeTables()
{ {
// Compute the offset table size // Compute the offset table size
m_OffsetTableSize = 1; m_OffsetTableSize = 1;
...@@ -133,7 +133,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo ...@@ -133,7 +133,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep> template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep> GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::FillWeightOffsetTable() const ::FillWeightOffsetTable()
{ {
// Initialize the neighborhood // Initialize the neighborhood
SizeType radius; SizeType radius;
...@@ -183,6 +183,21 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo ...@@ -183,6 +183,21 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
} }
} }
/** Initialize tables: need to be call explicitely */
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::Initialize()
{
// Delete existing tables
this->ResetOffsetTable();
// Tables initialization
this->InitializeTables();
// fill the weigth table
this->FillWeightOffsetTable();
m_TablesHaveBeenGenerated = true;
}
/** Evaluate at image index position */ /** Evaluate at image index position */
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep> template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
typename GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>::OutputType typename GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>::OutputType
...@@ -191,13 +206,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo ...@@ -191,13 +206,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
{ {
if (!m_TablesHaveBeenGenerated) if (!m_TablesHaveBeenGenerated)
{ {
// Delete existing tables itkExceptionMacro(<< "The Interpolation functor need to be explicitly intanciated with the method Initialize()");
this->ResetOffsetTable();
// Tables initialization
this->InitializeTables();
// fill the weigth table
this->FillWeightOffsetTable();
m_TablesHaveBeenGenerated = true;
} }
//unsigned int dim; //unsigned int dim;
......
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