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
b55b03a1
Commit
b55b03a1
authored
15 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
ENH: remove the facelist in otb::ConvolutionImageFilter
parent
4e0c734f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/BasicFilters/otbConvolutionImageFilter.txx
+39
-53
39 additions, 53 deletions
Code/BasicFilters/otbConvolutionImageFilter.txx
with
39 additions
and
53 deletions
Code/BasicFilters/otbConvolutionImageFilter.txx
+
39
−
53
View file @
b55b03a1
...
...
@@ -25,6 +25,7 @@
#include "itkNeighborhoodAlgorithm.h"
#include "itkOffset.h"
#include "itkProgressReporter.h"
#include "itkConstantBoundaryCondition.h"
namespace otb
{
...
...
@@ -96,74 +97,59 @@ ConvolutionImageFilter< TInputImage, TOutputImage, TBoundaryCondition>
::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
int threadId)
{
BoundaryConditionType nbc;
unsigned int i;
itk::ConstNeighborhoodIterator<InputImageType> bit;
itk::ImageRegionIterator<OutputImageType> it;
// Allocate output
typename OutputImageType::Pointer output = this->GetOutput();
typename InputImageType::ConstPointer input = this->GetInput();
// Find the data-set boundary "faces"
typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType>::FaceListType faceList;
itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType> bC;
faceList = bC(input, outputRegionForThread, m_Radius);
typename itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType>::FaceListType::iterator fit;
// support progress methods/callbacks
itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());
InputRealType sum = itk::NumericTraits<InputRealType>::Zero;
InputRealType norm = itk::NumericTraits<InputRealType>::Zero;
// Process each of the boundary faces. These are N-d regions which border
// the edge of the buffer.
for (fit=faceList.begin(); fit != faceList.end(); ++fit)
InputImageRegionType inputRegionForThread;
this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
itk::ConstNeighborhoodIterator<InputImageType, itk::ConstantBoundaryCondition<InputImageType> > inputIt(m_Radius, input, inputRegionForThread);
itk::ImageRegionIterator<OutputImageType> outputIt(output, outputRegionForThread);
inputIt.GoToBegin();
unsigned int neighborhoodSize = inputIt.Size();
// Compute the norm of the filter
if(m_NormalizeFilter)
{
norm = itk::NumericTraits<InputRealType>::Zero;
for (i = 0; i < neighborhoodSize; ++i)
{
norm += static_cast<InputRealType>( vcl_abs(m_Filter(i)) );
}
}
while ( ! inputIt.IsAtEnd() )
{
bit = itk::ConstNeighborhoodIterator<InputImageType>(m_Radius,
input, *fit);
it = itk::ImageRegionIterator<OutputImageType>(output, *fit);
bit.OverrideBoundaryCondition(&nbc);
bit.GoToBegin();
unsigned int neighborhoodSize = bit.Size();
// Compute the norm of the filter
if(m_NormalizeFilter)
{
norm = itk::NumericTraits<InputRealType>::Zero;
for (i = 0; i < neighborhoodSize; ++i)
{
norm += static_cast<InputRealType>( vcl_abs(m_Filter(i)) );
}
}
while ( ! bit.IsAtEnd() )
sum = itk::NumericTraits<InputRealType>::Zero;
for (i = 0; i < neighborhoodSize; ++i)
{
sum = itk::NumericTraits<InputRealType>::Zero;
for (i = 0; i < neighborhoodSize; ++i)
{
sum += static_cast<InputRealType>( bit.GetPixel(i)*m_Filter(i) );
}
// get the mean value
if (m_NormalizeFilter)
{
it.Set( static_cast<OutputPixelType>(sum / double(norm)) );
}
else
{
it.Set( static_cast<OutputPixelType>(sum));
}
++bit;
++it;
progress.CompletedPixel();
sum += static_cast<InputRealType>( inputIt.GetPixel(i)*m_Filter(i) );
}
// get the mean value
if (m_NormalizeFilter)
{
outputIt.Set( static_cast<OutputPixelType>(sum / double(norm)) );
}
else
{
outputIt.Set( static_cast<OutputPixelType>(sum));
}
++inputIt;
++outputIt;
progress.CompletedPixel();
}
}
...
...
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