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
61d8b4c3
Commit
61d8b4c3
authored
17 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
Correction mineure
parent
09ebd0ec
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.txx
+13
-41
13 additions, 41 deletions
...Filters/otbBinaryImageMinimalBoundingRegionCalculator.txx
with
13 additions
and
41 deletions
Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.txx
+
13
−
41
View file @
61d8b4c3
...
...
@@ -120,53 +120,25 @@ BinaryImageMinimalBoundingRegionCalculator<TInputImage>
rit.PreviousSlice();
}
}
// Compute size and index of the region
typename InputImageType::SizeType size;
typename InputImageType::IndexType index;
RegionType maxRegion = image->GetLargestPossibleRegion();
// If the pad option is activated
if(m_Pad>0)
{
for(int i=0;i<InputImageType::ImageDimension;i++)
{
// If we are not on boundary case, we can do what we want
if((int)(min[i]-m_Pad)> maxRegion.GetIndex()[i])
{
index[i]= min[i]-m_Pad;
}
// else we are at beginning of the image, so don't pad
else
{
index[i]= maxRegion.GetIndex()[i];
}
// If are not on boundary case, we can pad the size
if (index[i]+max[i]-min[i]+2*m_Pad+1<=maxRegion.GetIndex()[i]+maxRegion.GetSize()[i])
{
size[i]=max[i]-min[i]+2*m_Pad+1;
}
// Else we must restrain ourselves to the image boundaries
else
{
size[i]=maxRegion.GetSize()[i]+maxRegion.GetIndex()[i]
-max[i]+min[i]-index[i];
}
}
}
else
// If the pad option is not activated, the result is simple
for(int i=0;i<InputImageType::ImageDimension;i++)
{
for(int i=0;i<InputImageType::ImageDimension;i++)
{
size[i]=max[i]-min[i]+1;
index[i]=min[i];
}
size[i]=max[i]-min[i]+1;
index[i]=min[i];
}
// otbMsgDebugMacro(<<"BinaryImageMinimalBoundingBoxCalculator: index "<<index);
// otbMsgDebugMacro(<<"BinaryImageMinimalBoundingBoxCalculator: size "<<size);
// Set the size and index of the output region
m_Region.SetIndex(index);
m_Region.SetSize(size);
if(m_Pad)
{
m_Region.PadByRadius(m_Pad);
}
m_Region.Crop(image->GetLargestPossibleRegion());
}
/**
* PrintSelf method
...
...
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