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

STYLE

parent 9f379028
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
......
......@@ -7,7 +7,7 @@
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
......@@ -35,6 +35,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
this->SetNumberOfInputs(2);
m_AmplitudeThreshold = 1.0;
}
template <class TInputModulus, class TInputDirection, class TOutputPath>
void
VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
......@@ -42,6 +43,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
{
this->itk::ProcessObject::SetNthInput(0,const_cast<InputModulusType *>(inputModulus));
}
template <class TInputModulus, class TInputDirection, class TOutputPath>
const typename VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
::InputModulusType *
......@@ -54,6 +56,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
}
return static_cast<const TInputModulus*>(this->itk::ProcessObject::GetInput(0));
}
template <class TInputModulus, class TInputDirection, class TOutputPath>
void
VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
......@@ -61,6 +64,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
{
this->itk::ProcessObject::SetNthInput(1,const_cast<InputDirectionType *>(inputDirection));
}
template <class TInputModulus, class TInputDirection, class TOutputPath>
const typename VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
::InputDirectionType *
......@@ -73,6 +77,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
}
return static_cast<const TInputDirection *>(this->itk::ProcessObject::GetInput(1));
}
/**
* Main computation method
*/
......@@ -102,13 +107,13 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
DirRegionIteratorType dirIt(dirPtr,dirPtr->GetLargestPossibleRegion());
FlagRegionIteratorType flagIt(flagImage,flagImage->GetLargestPossibleRegion());
for (modIt.GoToBegin(),dirIt.GoToBegin(),flagIt.GoToBegin();
for (modIt.GoToBegin(), dirIt.GoToBegin(), flagIt.GoToBegin();
(!modIt.IsAtEnd()) && (!dirIt.IsAtEnd()) && (!flagIt.IsAtEnd());
++modIt,++dirIt,++flagIt)
++modIt, ++dirIt, ++flagIt)
{
if ((modIt.Get() > m_AmplitudeThreshold) && (!flagIt.Get()))
{
//this is a begining, to follow in two directions
//this is a beginning, to follow in two directions
OutputPathPointerType pathTempDirect = OutputPathType::New();
OutputPathPointerType pathTempReverse = OutputPathType::New();
OutputPathPointerType path = OutputPathType::New();
......@@ -117,9 +122,9 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
int flagReverse = 0;
double totalAmplitude = 0;
ModNeighborhoodIteratorType nModIt(radius,modPtr,modPtr->GetLargestPossibleRegion());
DirNeighborhoodIteratorType nDirIt(radius,dirPtr,dirPtr->GetLargestPossibleRegion());
FlagNeighborhoodIteratorType nFlagIt(radius,flagImage,flagImage->GetLargestPossibleRegion());
ModNeighborhoodIteratorType nModIt(radius, modPtr, modPtr->GetLargestPossibleRegion());
DirNeighborhoodIteratorType nDirIt(radius, dirPtr, dirPtr->GetLargestPossibleRegion());
FlagNeighborhoodIteratorType nFlagIt(radius, flagImage, flagImage->GetLargestPossibleRegion());
for (flagReverse=0; flagReverse < 2; ++flagReverse)
{
......@@ -145,7 +150,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
offsetVector =GetThreeNeighborOffsetFromDirection(nDirIt.GetCenterPixel(),flagReverse);
OffsetIteratorType vecIt = offsetVector.begin();
bool flagFound=false;
while (vecIt!=offsetVector.end()&&!flagFound)
while (vecIt != offsetVector.end() && !flagFound)
{
flagFound = nModIt.GetPixel(*vecIt) > 0
&& !nFlagIt.GetPixel(*vecIt);
......@@ -156,7 +161,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
point.Fill(0);
PointType tmpPoint;
totalAmplitude = 0;
for (vecIt = offsetVector.begin();vecIt!=offsetVector.end();++vecIt)
for (vecIt = offsetVector.begin(); vecIt != offsetVector.end(); ++vecIt)
{
totalAmplitude += nModIt.GetPixel(*vecIt);
modPtr->TransformIndexToPhysicalPoint(nModIt.GetIndex(*vecIt),tmpPoint);
......@@ -248,6 +253,7 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
}
}
}
/**
* Compute the 8 neighbors to explore from the direction and the type of search (forward or backward).
* \param direction The direction
......@@ -283,237 +289,239 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
switch ( neighborhoodNumber )
{
case 0:
tmpOffset[0]=1;
tmpOffset[1]=0;
tmpOffset[0] = 1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=1;
tmpOffset[1]=1;
tmpOffset[0] = 1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=1;
tmpOffset[0] = 0;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=2;
tmpOffset[1]=0;
tmpOffset[0] = 2;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=2;
tmpOffset[1]=1;
tmpOffset[0] = 2;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=2;
tmpOffset[1]=2;
tmpOffset[0] = 2;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=1;
tmpOffset[1]=2;
tmpOffset[0] = 1;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=2;
tmpOffset[0] = 0;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
break;
case 1:
tmpOffset[0]=1;
tmpOffset[1]=1;
tmpOffset[0] = 1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=1;
tmpOffset[0] = 0;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=1;
tmpOffset[0] = -1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=2;
tmpOffset[1]=2;
tmpOffset[0] = 2;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=1;
tmpOffset[1]=2;
tmpOffset[0] = 1;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=2;
tmpOffset[0] = 0;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=2;
tmpOffset[0] = -1;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=2;
tmpOffset[0] = -2;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
break;
case 2:
tmpOffset[0]=0;
tmpOffset[1]=1;
tmpOffset[0] = 0;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=1;
tmpOffset[0] = -1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=0;
tmpOffset[0] = -1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=2;
tmpOffset[0] = 0;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=2;
tmpOffset[0] = -1;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=2;
tmpOffset[0] = -2;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=1;
tmpOffset[0] = -2;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=0;
tmpOffset[0] = -2;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
break;
case 3:
tmpOffset[0]=-1;
tmpOffset[1]=1;
tmpOffset[0] = -1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=0;
tmpOffset[0] = -1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=-1;
tmpOffset[0] = -1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=2;
tmpOffset[0] = -2;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=1;
tmpOffset[0] = -2;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=0;
tmpOffset[0] = -2;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=-1;
tmpOffset[0] = -2;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=-2;
tmpOffset[0] = -2;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
break;
case 4:
tmpOffset[0]=-1;
tmpOffset[1]=0;
tmpOffset[0] = -1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=-1;
tmpOffset[0] = -1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=-1;
tmpOffset[0] = 0;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=0;
tmpOffset[0] = -2;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=-1;
tmpOffset[0] = -2;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=-2;
tmpOffset[0] = -2;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=-2;
tmpOffset[0] = -1;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=-2;
tmpOffset[0] = 0;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
break;
case 5:
tmpOffset[0]=-1;
tmpOffset[1]=-1;
tmpOffset[0] = -1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=-1;
tmpOffset[0] = 0;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=1;
tmpOffset[1]=-1;
tmpOffset[0] = 1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=-2;
tmpOffset[1]=-2;
tmpOffset[0] = -2;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=-2;
tmpOffset[0] = -1;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]= 0;
tmpOffset[1]=-2;
tmpOffset[0] = 0;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]=-2;
tmpOffset[0] = 1;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]=2;
tmpOffset[1]=-2;
tmpOffset[0] = 2;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
break;
case 6:
tmpOffset[0]= 0;
tmpOffset[1]=-1;
tmpOffset[0] = 0;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]=-1;
tmpOffset[0] = 1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]= 0;
tmpOffset[0] = 1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]= 0;
tmpOffset[1]=-2;
tmpOffset[0] = 0;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]=-2;
tmpOffset[0] = 1;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]=-2;
tmpOffset[0] = 2;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]=-1;
tmpOffset[0] = 2;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]= 0;
tmpOffset[0] = 2;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
break;
case 7:
tmpOffset[0]= 1;
tmpOffset[1]=-1;
tmpOffset[0] = 1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]= 0;
tmpOffset[0] = 1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]= 1;
tmpOffset[0] = 1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]=-2;
tmpOffset[0] = 2;
tmpOffset[1] = -2;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]=-1;
tmpOffset[0] = 2;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]= 0;
tmpOffset[0] = 2;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]= 1;
tmpOffset[0] = 2;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]= 2;
tmpOffset[1]= 2;
tmpOffset[0] = 2;
tmpOffset[1] = 2;
offset.push_back(tmpOffset);
break;
}
return offset;
}/**
* Compute the 3 neighbors to explore from the direction and the type of search (forward or backward).
* \param direction The direction
* \param flagReverse The type of search
* \return The neighborhood
*/
}
/**
* Compute the 3 neighbors to explore from the direction and the type of search (forward or backward).
* \param direction The direction
* \param flagReverse The type of search
* \return The neighborhood
*/
template <class TInputModulus, class TInputDirection, class TOutputPath>
typename VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
::OffsetVectorType
......@@ -543,105 +551,105 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
switch ( neighborhoodNumber )
{
case 0:
tmpOffset[0]=1;
tmpOffset[1]=0;
tmpOffset[0] = 1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=1;
tmpOffset[1]=1;
tmpOffset[0] = 1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=1;
tmpOffset[0] = 0;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
break;
case 1:
tmpOffset[0]=1;
tmpOffset[1]=1;
tmpOffset[0] = 1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=1;
tmpOffset[0] = 0;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=1;
tmpOffset[0] = -1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
break;
case 2:
tmpOffset[0]=0;
tmpOffset[1]=1;
tmpOffset[0] = 0;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=1;
tmpOffset[0] = -1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=0;
tmpOffset[0] = -1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
break;
case 3:
tmpOffset[0]=-1;
tmpOffset[1]=1;
tmpOffset[0] = -1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=0;
tmpOffset[0] = -1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=-1;
tmpOffset[0] = -1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
break;
case 4:
tmpOffset[0]=-1;
tmpOffset[1]=0;
tmpOffset[0] = -1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]=-1;
tmpOffset[1]=-1;
tmpOffset[0] = -1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=-1;
tmpOffset[0] = 0;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
break;
case 5:
tmpOffset[0]=-1;
tmpOffset[1]=-1;
tmpOffset[0] = -1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=0;
tmpOffset[1]=-1;
tmpOffset[0] = 0;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]=1;
tmpOffset[1]=-1;
tmpOffset[0] = 1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
break;
case 6:
tmpOffset[0]= 0;
tmpOffset[1]=-1;
tmpOffset[0] = 0;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]=-1;
tmpOffset[0] = 1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]= 0;
tmpOffset[0] = 1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
break;
case 7:
tmpOffset[0]= 1;
tmpOffset[1]=-1;
tmpOffset[0] = 1;
tmpOffset[1] = -1;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]= 0;
tmpOffset[0] = 1;
tmpOffset[1] = 0;
offset.push_back(tmpOffset);
tmpOffset[0]= 1;
tmpOffset[1]= 1;
tmpOffset[0] = 1;
tmpOffset[1] = 1;
offset.push_back(tmpOffset);
break;
......@@ -659,5 +667,6 @@ VectorizationPathListFilter<TInputModulus, TInputDirection, TOutputPath>
{
Superclass::PrintSelf(os, indent);
}
} // End namespace otb
#endif
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