Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
8e25c83f
Commit
8e25c83f
authored
17 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
correction genericInterpolateImageFunction
parent
ef447b31
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Common/otbGenericInterpolateImageFunction.h
+19
-10
19 additions, 10 deletions
Code/Common/otbGenericInterpolateImageFunction.h
Code/Common/otbGenericInterpolateImageFunction.txx
+40
-14
40 additions, 14 deletions
Code/Common/otbGenericInterpolateImageFunction.txx
with
59 additions
and
24 deletions
Code/Common/otbGenericInterpolateImageFunction.h
+
19
−
10
View file @
8e25c83f
...
...
@@ -98,17 +98,20 @@ public itk::InterpolateImageFunction<TInputImage,TCoordRep>
}
/** Delete tables.*/
void
ResetOffsetTable
();
void
ResetOffsetTable
()
const
;
/** Initialize used tables*/
void
InitializeTables
();
void
InitializeTables
()
const
;
/** Fill the weight offset table*/
void
FillWeightOffsetTable
();
void
FillWeightOffsetTable
()
const
;
protected
:
GenericInterpolateImageFunction
();
~
GenericInterpolateImageFunction
();
void
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
;
/** Call the superclass implementation and set the TablesHaveBeenGenerated
* flag to false */
virtual
void
Modified
(
void
);
private
:
GenericInterpolateImageFunction
(
const
Self
&
);
//purposely not implemented
...
...
@@ -118,17 +121,23 @@ public itk::InterpolateImageFunction<TInputImage,TCoordRep>
// Constant to store twice the radius
unsigned
int
m_WindowSize
;
/** The offset array, used to keep a list of relevant
* offsets in the neihborhoodIterator */
unsigned
int
*
m_OffsetTable
;
/** Used function */
FunctionType
m_Function
;
/** Size of the offset table */
unsigned
int
m_OffsetTableSize
;
/** Store the image dimension.*/
unsigned
int
m_ImageDimension
;
/** These members are declared mutable so that they can be
regenerated seamlessly inside the EvaluateAtContinuousIndex method if
they need to */
/** Size of the offset table */
mutable
unsigned
int
m_OffsetTableSize
;
/** The offset array, used to keep a list of relevant
* offsets in the neihborhoodIterator */
mutable
unsigned
int
*
m_OffsetTable
;
/** Index into the weights array for each offset */
unsigned
int
**
m_WeightOffsetTable
;
mutable
unsigned
int
**
m_WeightOffsetTable
;
/** True if internal statistics have been generated */
mutable
bool
m_TablesHaveBeenGenerated
;
};
}
// end namespace itk
...
...
This diff is collapsed.
Click to expand it.
Code/Common/otbGenericInterpolateImageFunction.txx
+
40
−
14
View file @
8e25c83f
...
...
@@ -28,6 +28,9 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
{
//m_Radius = 1;
m_WindowSize = 1;
m_OffsetTable = NULL;
m_WeightOffsetTable = NULL;
m_TablesHaveBeenGenerated=false;
}
/** Destructor */
...
...
@@ -42,17 +45,25 @@ GenericInterpolateImageFunction<TInputImage, TFunction,TBoundaryCondition, TCoor
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::ResetOffsetTable()
::ResetOffsetTable()
const
{
// Clear the offset table
delete [] m_OffsetTable;
if(m_OffsetTable!=NULL)
{
delete [] m_OffsetTable;
m_OffsetTable=NULL;
}
// Clear the weights ta
b
les
for(unsigned int i=0; i < m_
OffsetTable
Size; i++
)
// Clear the weights tales
if(m_Weight
OffsetTable
!=NULL
)
{
delete [] m_WeightOffsetTable[i];
for(unsigned int i=0; i < m_OffsetTableSize; i++)
{
delete [] m_WeightOffsetTable[i];
}
delete[] m_WeightOffsetTable;
m_WeightOffsetTable = NULL;
}
delete[] m_WeightOffsetTable;
}
...
...
@@ -78,20 +89,24 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
//m_Radius = rad;
this->GetFunction().SetRadius(rad);
m_WindowSize = rad << 1;
// Delete existing tables
this->ResetOffsetTable();
// Tables initialization
this->InitializeTables();
// fill the weigth table
this->FillWeightOffsetTable();
this->Modified();
}
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::Modified()
{
Superclass::Modified();
m_TablesHaveBeenGenerated=false;
}
/** Initialize used tables*/
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::InitializeTables()
::InitializeTables()
const
{
// Compute the offset table size
m_OffsetTableSize = 1;
...
...
@@ -115,7 +130,7 @@ GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoo
template<class TInputImage, class TFunction, class TBoundaryCondition, class TCoordRep>
void
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::FillWeightOffsetTable()
::FillWeightOffsetTable()
const
{
// Initialize the neighborhood
SizeType radius;
...
...
@@ -171,6 +186,17 @@ typename GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondit
GenericInterpolateImageFunction<TInputImage, TFunction, TBoundaryCondition, TCoordRep>
::EvaluateAtContinuousIndex(const ContinuousIndexType& index) const
{
if(!m_TablesHaveBeenGenerated)
{
// Delete existing tables
this->ResetOffsetTable();
// Tables initialization
this->InitializeTables();
// fill the weigth table
this->FillWeightOffsetTable();
m_TablesHaveBeenGenerated=true;
}
unsigned int dim;
IndexType baseIndex;
double distance[ImageDimension];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment