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
Container Registry
Model registry
Operate
Environments
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
Main Repositories
otb
Commits
a1b00917
Commit
a1b00917
authored
13 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
ENH: improve to handle neighborhood
parent
a5113bdf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/BasicFilters/otbSpectralAngleDataNodeFeatureFunction.txx
+9
-52
9 additions, 52 deletions
.../BasicFilters/otbSpectralAngleDataNodeFeatureFunction.txx
with
9 additions
and
52 deletions
Code/BasicFilters/otbSpectralAngleDataNodeFeatureFunction.txx
+
9
−
52
View file @
a1b00917
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "otbSpectralAngleDataNodeFeatureFunction.h"
#include "otbSpectralAngleDataNodeFeatureFunction.h"
//#include "itkImageIteratorWithIndex.h"
namespace otb
namespace otb
{
{
...
@@ -95,16 +94,13 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
...
@@ -95,16 +94,13 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
typename LineType::VertexListConstIteratorType it1 = path->GetVertexList()->Begin();
typename LineType::VertexListConstIteratorType it1 = path->GetVertexList()->Begin();
typename LineType::VertexListConstIteratorType it2 = path->GetVertexList()->Begin();
typename LineType::VertexListConstIteratorType it2 = path->GetVertexList()->Begin();
typename LineType::VertexListConstIteratorType itStop = path->GetVertexList()->End();
typename LineType::VertexListConstIteratorType itStop = path->GetVertexList()->End();
++it2;
++it2;
if( it2 == itStop )
if( it2 == itStop )
{
{
itkExceptionMacro(<< "Invalid DataNode, must at least contain two points");
itkExceptionMacro(<< "Invalid DataNode, must at least contain two points");
}
}
//unsigned int count = 0;
while ( it1 != itStop && it2 != itStop)
while ( it1 != itStop && it2 != itStop)
{
{
IndexType id1, id2;
IndexType id1, id2;
...
@@ -114,7 +110,6 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
...
@@ -114,7 +110,6 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
id2[1] = static_cast<int>(it2.Value()[1]);
id2[1] = static_cast<int>(it2.Value()[1]);
splitedLineIdCentral.push_back(IndexPairType( id1, id2 ));
splitedLineIdCentral.push_back(IndexPairType( id1, id2 ));
for(unsigned int j=m_StartNeighborhoodRadius; j<m_StopNeighborhoodRadius; j++)
for(unsigned int j=m_StartNeighborhoodRadius; j<m_StopNeighborhoodRadius; j++)
{
{
IndexType shift11, shift12;
IndexType shift11, shift12;
...
@@ -127,41 +122,21 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
...
@@ -127,41 +122,21 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
shift21[1] = id2[1]-j;
shift21[1] = id2[1]-j;
shift22[0] = id2[0]+j;
shift22[0] = id2[0]+j;
shift22[1] = id2[1]+j;
shift22[1] = id2[1]+j;
splitedLineIdNeigh.push_back(IndexPairType( shift11, shift21 ));
splitedLineIdNeigh.push_back(IndexPairType( shift11, shift21 ));
splitedLineIdNeigh.push_back(IndexPairType( shift12, shift22 ));
splitedLineIdNeigh.push_back(IndexPairType( shift12, shift22 ));
}
}
++it1;
++it1;
++it2;
++it2;
}
}
// in FEATURE_POLYGON case, first point appears twice (fisrt vertex and last vertew, thus we create a line of 1 point...)
if( node.GetNodeType() == FEATURE_POLYGON )
if( node.GetNodeType() == FEATURE_POLYGON )
{
{
it2--;
splitedLineIdCentral.pop_back();
IndexType id1, id2;
splitedLineIdNeigh.pop_back();
id1[0] = static_cast<int>(path->GetVertexList()->Begin().Value()[0]);
splitedLineIdNeigh.pop_back();
id1[1] = static_cast<int>(path->GetVertexList()->Begin().Value()[1]);
id2[0] = static_cast<int>(it2.Value()[0]);
id2[1] = static_cast<int>(it2.Value()[1]);
splitedLineIdCentral.push_back(IndexPairType( id1, id2 ));
for(unsigned int j=m_StartNeighborhoodRadius; j<m_StopNeighborhoodRadius; j++)
{
IndexType shift11, shift12;
shift11[0] = id1[0]-j;
shift11[1] = id1[1]-j;
shift12[0] = id1[0]+j;
shift12[1] = id1[1]+j;
IndexType shift21, shift22;
shift21[0] = id2[0]-j;
shift21[1] = id2[1]-j;
shift22[0] = id2[0]+j;
shift22[1] = id2[1]+j;
splitedLineIdNeigh.push_back(IndexPairType( shift11, shift21 ));
splitedLineIdNeigh.push_back(IndexPairType( shift12, shift22 ));
}
}
}
...
@@ -172,20 +147,11 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
...
@@ -172,20 +147,11 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
{
{
LineIteratorType lineIt( this->GetInputImage(), splitedLineIdCentral[i].first, splitedLineIdCentral[i].second);
LineIteratorType lineIt( this->GetInputImage(), splitedLineIdCentral[i].first, splitedLineIdCentral[i].second);
lineIt.GoToBegin();
lineIt.GoToBegin();
//itk::ImageIteratorWithIndex<TImage> lol(this->GetInputImage());
while(!lineIt.IsAtEnd())
while(!lineIt.IsAtEnd())
{
{
if(this->IsInsideBuffer(lineIt.GetIndex()))
if(this->IsInsideBuffer(lineIt.GetIndex()))
{
{
/*
std::cout << "m_SpectralAngleFunctor : "
<< m_SpectralAngleFunctor(lineIt.Get(), this->GetRefPixel())
<< " - currentPixel : "
<< lineIt.Get()
<< " - RefPixel : "
<< this->GetRefPixel()
<< std::endl;
*/
PixelType currPixel;
PixelType currPixel;
currPixel.SetSize(std::min(this->GetRefPixel().Size(), lineIt.Get().Size()));
currPixel.SetSize(std::min(this->GetRefPixel().Size(), lineIt.Get().Size()));
for (unsigned int i=0; i<std::min(this->GetRefPixel().Size(), lineIt.Get().Size()); i++)
for (unsigned int i=0; i<std::min(this->GetRefPixel().Size(), lineIt.Get().Size()); i++)
...
@@ -204,22 +170,13 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
...
@@ -204,22 +170,13 @@ typename SpectralAngleDataNodeFeatureFunction<TImage, TCoordRep, TPrecision>
for(unsigned int i=0; i<splitedLineIdNeigh.size(); i++)
for(unsigned int i=0; i<splitedLineIdNeigh.size(); i++)
{
{
LineIteratorType lineIt( this->GetInputImage(), splitedLineId
Central
[i].first, splitedLineId
Central
[i].second);
LineIteratorType lineIt( this->GetInputImage(), splitedLineId
Neigh
[i].first, splitedLineId
Neigh
[i].second);
lineIt.GoToBegin();
lineIt.GoToBegin();
while(!lineIt.IsAtEnd())
while(!lineIt.IsAtEnd())
{
{
if(this->IsInsideBuffer(lineIt.GetIndex()))
if(this->IsInsideBuffer(lineIt.GetIndex()))
{
{
/*
std::cout << "m_SpectralAngleFunctor : "
<< m_SpectralAngleFunctor(lineIt.Get(), this->GetRefPixel())
<< " - currentPixel : "
<< lineIt.Get()
<< " - RefPixel : "
<< this->GetRefPixel()
<< std::endl;
*/
PixelType currPixel;
PixelType currPixel;
currPixel.SetSize(std::min(this->GetRefPixel().Size(), lineIt.Get().Size()));
currPixel.SetSize(std::min(this->GetRefPixel().Size(), lineIt.Get().Size()));
for (unsigned int i=0; i<std::min(this->GetRefPixel().Size(), lineIt.Get().Size()); i++)
for (unsigned int i=0; i<std::min(this->GetRefPixel().Size(), lineIt.Get().Size()); i++)
...
...
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