Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
16a15c11
Commit
16a15c11
authored
Apr 30, 2012
by
Sebastien Harasse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
STYLE: Variable renaming, indenting
parent
61b672dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
38 deletions
+42
-38
Code/BasicFilters/otbMeanShiftImageFilter2.h
Code/BasicFilters/otbMeanShiftImageFilter2.h
+21
-17
Code/BasicFilters/otbMeanShiftImageFilter2.txx
Code/BasicFilters/otbMeanShiftImageFilter2.txx
+21
-21
No files found.
Code/BasicFilters/otbMeanShiftImageFilter2.h
View file @
16a15c11
...
...
@@ -44,7 +44,8 @@ public:
SpatialRangeJointDomainTransform
()
{}
~
SpatialRangeJointDomainTransform
()
{}
inline
typename
TOutputJointImage
::
PixelType
operator
()
(
const
typename
TInputImage
::
PixelType
&
inputPixel
,
const
typename
TInputImage
::
IndexType
&
index
)
inline
typename
TOutputJointImage
::
PixelType
operator
()
(
const
typename
TInputImage
::
PixelType
&
inputPixel
,
const
typename
TInputImage
::
IndexType
&
index
)
{
typename
TOutputJointImage
::
PixelType
jointPixel
;
jointPixel
.
SetSize
(
ImageDimension
+
m_NumberOfComponentsPerPixel
);
...
...
@@ -60,7 +61,8 @@ public:
return
jointPixel
;
}
void
Initialize
(
unsigned
int
_ImageDimension
,
unsigned
int
_m_NumberOfComponentsPerPixel
,
RealType
_m_SpatialBandwidth
,
RealType
_m_RangeBandwidth
)
void
Initialize
(
unsigned
int
_ImageDimension
,
unsigned
int
_m_NumberOfComponentsPerPixel
,
RealType
_m_SpatialBandwidth
,
RealType
_m_RangeBandwidth
)
{
ImageDimension
=
_ImageDimension
;
m_NumberOfComponentsPerPixel
=
_m_NumberOfComponentsPerPixel
;
...
...
@@ -78,8 +80,8 @@ private:
unsigned
int
ImageDimension
;
unsigned
int
m_NumberOfComponentsPerPixel
;
unsigned
int
m_OutputSize
;
RealType
m_SpatialBandwidth
;
RealType
m_RangeBandwidth
;
RealType
m_SpatialBandwidth
;
RealType
m_RangeBandwidth
;
};
...
...
@@ -169,15 +171,15 @@ public:
/** Template parameters typedefs */
typedef
TInputImage
InputImageType
;
typedef
typename
InputImageType
::
Pointer
InputImagePointerType
;
typedef
typename
InputImageType
::
PixelType
InputPixelType
;
typedef
typename
InputImageType
::
IndexType
InputIndexType
;
typedef
typename
InputImageType
::
SizeType
InputSizeType
;
typedef
TInputImage
InputImageType
;
typedef
typename
InputImageType
::
Pointer
InputImagePointerType
;
typedef
typename
InputImageType
::
PixelType
InputPixelType
;
typedef
typename
InputImageType
::
IndexType
InputIndexType
;
typedef
typename
InputImageType
::
SizeType
InputSizeType
;
typedef
typename
InputImageType
::
IndexValueType
InputIndexValueType
;
typedef
typename
InputImageType
::
PointType
PointType
;
typedef
typename
InputImageType
::
RegionType
RegionType
;
typedef
typename
InputImageType
::
SizeType
SizeType
;
typedef
typename
InputImageType
::
PointType
PointType
;
typedef
typename
InputImageType
::
RegionType
RegionType
;
typedef
typename
InputImageType
::
SizeType
SizeType
;
typedef
TOutputImage
OutputImageType
;
typedef
typename
OutputImageType
::
Pointer
OutputImagePointerType
;
...
...
@@ -195,13 +197,13 @@ public:
typedef
typename
OutputSpatialImageType
::
Pointer
OutputSpatialImagePointerType
;
typedef
typename
OutputSpatialImageType
::
PixelType
OutputSpatialPixelType
;
typedef
TKernel
KernelType
;
typedef
TKernel
KernelType
;
itkStaticConstMacro
(
ImageDimension
,
unsigned
int
,
InputImageType
::
ImageDimension
);
typedef
itk
::
VariableLengthVector
<
RealType
>
RealVector
;
typedef
itk
::
VariableLengthVector
<
RealType
>
RealVector
;
typedef
otb
::
VectorImage
<
RealType
,
InputImageType
::
ImageDimension
>
RealVectorImageType
;
typedef
otb
::
Image
<
unsigned
short
,
InputImageType
::
ImageDimension
>
ModeTableImageType
;
typedef
otb
::
Image
<
unsigned
short
,
InputImageType
::
ImageDimension
>
ModeTableImageType
;
/** Setters / Getters */
itkSetMacro
(
SpatialBandwidth
,
RealType
);
...
...
@@ -276,7 +278,9 @@ protected:
/** PrintSelf method */
virtual
void
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
;
virtual
void
CalculateMeanShiftVector
(
typename
RealVectorImageType
::
Pointer
inputImagePtr
,
RealVector
jointPixel
,
const
OutputRegionType
&
outputRegion
,
RealVector
&
meanShiftVector
);
virtual
void
CalculateMeanShiftVector
(
typename
RealVectorImageType
::
Pointer
inputImagePtr
,
RealVector
jointPixel
,
const
OutputRegionType
&
outputRegion
,
RealVector
&
meanShiftVector
);
private:
MeanShiftImageFilter2
(
const
Self
&
);
//purposely not implemented
...
...
@@ -313,7 +317,7 @@ private:
* 2 : pixel is in the path of the currently processed pixel and a mode will
* be assigned to it
*/
typename
ModeTableImageType
::
Pointer
m_
m
odeTable
;
typename
ModeTableImageType
::
Pointer
m_
M
odeTable
;
/** Boolean to enable mode search optimization */
bool
m_ModeSearchOptimization
;
...
...
Code/BasicFilters/otbMeanShiftImageFilter2.txx
View file @
16a15c11
...
...
@@ -347,10 +347,10 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
// 0 : no mode has been found yet
// 1 : a mode has been assigned to this pixel
// 2 : a mode will be assigned to this pixel
m_
m
odeTable = ModeTableImageType::New();
m_
m
odeTable->SetRegions(inputPtr->GetRequestedRegion());
m_
m
odeTable->Allocate();
m_
m
odeTable->FillBuffer(0);
m_
M
odeTable = ModeTableImageType::New();
m_
M
odeTable->SetRegions(inputPtr->GetRequestedRegion());
m_
M
odeTable->Allocate();
m_
M
odeTable->FillBuffer(0);
}
}
...
...
@@ -481,25 +481,25 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
this->AllocateOutputs();
// Retrieve output images pointers
typename OutputSpatialImageType::Pointer spatialOutput = this->GetSpatialOutput();
typename OutputImageType::Pointer rangeOutput = this->GetRangeOutput();
typename OutputMetricImageType::Pointer metricOutput = this->GetMetricOutput();
typename OutputSpatialImageType::Pointer
spatialOutput = this->GetSpatialOutput();
typename OutputImageType::Pointer
rangeOutput = this->GetRangeOutput();
typename OutputMetricImageType::Pointer
metricOutput = this->GetMetricOutput();
typename OutputIterationImageType::Pointer iterationOutput = this->GetIterationOutput();
// Get input image pointer
typename InputImageType::ConstPointer input = this->GetInput();
// defines input and output iterators
typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType;
typedef itk::ImageRegionIterator<OutputSpatialImageType> OutputSpatialIteratorType;
typedef itk::ImageRegionIterator<OutputMetricImageType> OutputMetricIteratorType;
typedef itk::ImageRegionConstIteratorWithIndex<InputImageType> InputIteratorWithIndexType;
typedef itk::ImageRegionIterator<OutputIterationImageType> OutputIterationIteratorType;
typedef itk::ImageRegionIterator<OutputImageType>
OutputIteratorType;
typedef itk::ImageRegionIterator<OutputSpatialImageType>
OutputSpatialIteratorType;
typedef itk::ImageRegionIterator<OutputMetricImageType>
OutputMetricIteratorType;
typedef itk::ImageRegionConstIteratorWithIndex<InputImageType>
InputIteratorWithIndexType;
typedef itk::ImageRegionIterator<OutputIterationImageType>
OutputIterationIteratorType;
typename OutputImageType::PixelType rangePixel;
typename OutputSpatialImageType::PixelType spatialPixel;
typename OutputMetricImageType::PixelType metricPixel;
typename OutputImageType::PixelType
rangePixel;
typename OutputSpatialImageType::PixelType
spatialPixel;
typename OutputMetricImageType::PixelType
metricPixel;
typename OutputIterationImageType::PixelType iterationPixel;
InputIndexType index;
...
...
@@ -583,7 +583,7 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
// but not 2 (pixel in current search path), and pixel has actually moved
// from its initial position, and pixel candidate is inside the output
// region, then perform optimization tasks
if (m_
m
odeTable->GetPixel(modeCandidate) != 2 && modeCandidate != currentIndex && outputRegionForThread.IsInside(modeCandidate))
if (m_
M
odeTable->GetPixel(modeCandidate) != 2 && modeCandidate != currentIndex && outputRegionForThread.IsInside(modeCandidate))
{
// Obtain the data point to see if it close to jointPixel
RealVector candidatePixel;
...
...
@@ -600,12 +600,12 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
{
// If no mode has been associated to the candidate pixel then
// associate it to the upcoming mode
if( m_
m
odeTable->GetPixel(modeCandidate) == 0)
if( m_
M
odeTable->GetPixel(modeCandidate) == 0)
{
// Add the candidate to the list of pixels that will be assigned the
// finally calculated mode value
pointList[pointCount++] = modeCandidate;
m_
m
odeTable->SetPixel(modeCandidate, 2);
m_
M
odeTable->SetPixel(modeCandidate, 2);
} else // == 1
{
// The candidate pixel has already been assigned to a mode
...
...
@@ -616,7 +616,7 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
jointPixel[ImageDimension + comp] = rangePixel[comp] / m_RangeBandwidth;
}
// Update the mode table because pixel will be assigned just now
m_
m
odeTable->SetPixel(currentIndex, 2);
m_
M
odeTable->SetPixel(currentIndex, 2);
// bypass further calculation
numBreaks++;
break;
...
...
@@ -673,13 +673,13 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
if (m_ModeSearchOptimization)
{
// Update the mode table now that the current pixel has been assigned
m_
m
odeTable->SetPixel(currentIndex, 1);
m_
M
odeTable->SetPixel(currentIndex, 1);
// Also assign all points in the list to the same mode
for (unsigned int i = 0; i < pointCount; i++)
{
rangeOutput->SetPixel(pointList[i], rangePixel);
m_
m
odeTable->SetPixel(pointList[i], 1);
m_
M
odeTable->SetPixel(pointList[i], 1);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment