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
b451247f
Commit
b451247f
authored
10 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Mantis-942: pixel convention consistency for Code/Projections filters
parent
bd42c90f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Projections/otbImageToGenericRSOutputParameters.txx
+21
-21
21 additions, 21 deletions
Code/Projections/otbImageToGenericRSOutputParameters.txx
Code/Projections/otbVectorDataIntoImageProjectionFilter.txx
+18
-13
18 additions, 13 deletions
Code/Projections/otbVectorDataIntoImageProjectionFilter.txx
with
39 additions
and
34 deletions
Code/Projections/otbImageToGenericRSOutputParameters.txx
+
21
−
21
View file @
b451247f
...
...
@@ -21,6 +21,7 @@
#include "otbImageToGenericRSOutputParameters.h"
#include "itkMacro.h"
#include "itkContinuousIndex.h"
namespace otb {
...
...
@@ -56,15 +57,15 @@ ImageToGenericRSOutputParameters<TImage>
// Estimate the Output image Extent
this->EstimateOutputImageExtent();
// Estimate the Output Origin
this->EstimateOutputOrigin();
// Estimate the Output Spacing
if(!m_ForceSpacing)
this->EstimateOutputSpacing();
// Finally Estimate the Output Size
this->EstimateOutputSize();
// Estimate the Output Origin
this->EstimateOutputOrigin();
}
...
...
@@ -94,25 +95,24 @@ ImageToGenericRSOutputParameters<TImage>
m_Transform->GetInverse(invTransform);
// Compute the 4 corners in the cartographic coordinate system
std::vector<
IndexType>
vindex;
std::vector<
itk::ContinuousIndex<double,2> >
vindex;
std::vector<PointType> voutput;
IndexType index1, index2, index3, index4;
SizeType size;
itk::ContinuousIndex<double,2> index1(m_Input->GetLargestPossibleRegion().GetIndex());
index1[0] += -0.5;
index1[1] += -0.5;
itk::ContinuousIndex<double,2> index2(index1);
itk::ContinuousIndex<double,2> index3(index1);
itk::ContinuousIndex<double,2> index4(index1);
// Image size
size = m_Input->GetLargestPossibleRegion().GetSize();
SizeType
size = m_Input->GetLargestPossibleRegion().GetSize();
// project the 4 corners
index1 = m_Input->GetLargestPossibleRegion().GetIndex();
index2 = m_Input->GetLargestPossibleRegion().GetIndex();
index3 = m_Input->GetLargestPossibleRegion().GetIndex();
index4 = m_Input->GetLargestPossibleRegion().GetIndex();
index2[0] += size[0] - 1;
index3[0] += size[0] - 1;
index3[1] += size[1] - 1;
index4[1] += size[1] - 1;
index2[0] += size[0];
index3[0] += size[0];
index3[1] += size[1];
index4[1] += size[1];
vindex.push_back(index1);
vindex.push_back(index2);
...
...
@@ -122,7 +122,7 @@ ImageToGenericRSOutputParameters<TImage>
for (unsigned int i = 0; i < vindex.size(); ++i)
{
PointType physicalPoint;
m_Input->TransformIndexToPhysicalPoint(vindex[i], physicalPoint);
m_Input->Transform
Continuous
IndexToPhysicalPoint(vindex[i], physicalPoint);
voutput.push_back(invTransform->TransformPoint(physicalPoint));
}
...
...
@@ -168,8 +168,8 @@ ImageToGenericRSOutputParameters<TImage>
// Set the output orgin in carto
// projection
PointType origin;
origin[0] = m_OutputExtent.minX;
origin[1] = m_OutputExtent.maxY;
origin[0] = m_OutputExtent.minX
+ 0.5 * this->GetOutputSpacing()[0]
;
origin[1] = m_OutputExtent.maxY
+ 0.5 * this->GetOutputSpacing()[1]
;
this->SetOutputOrigin(origin);
}
...
...
@@ -187,8 +187,8 @@ ImageToGenericRSOutputParameters<TImage>
double sizeCartoY = vcl_abs(m_OutputExtent.minY - m_OutputExtent.maxY);
PointType o, oX, oY;
o[0] =
this->GetOutputOrigin()[0]
;
o[1] =
this->GetOutputOrigin()[1]
;
o[0] =
m_OutputExtent.minX
;
o[1] =
m_OutputExtent.maxY
;
oX = o;
oY = o;
...
...
This diff is collapsed.
Click to expand it.
Code/Projections/otbVectorDataIntoImageProjectionFilter.txx
+
18
−
13
View file @
b451247f
...
...
@@ -119,6 +119,7 @@ VectorDataIntoImageProjectionFilter<TInputVectorData, TInputImage>
typedef typename ImageType::IndexType IndexType;
typedef typename ImageType::PointType PointType;
typedef typename ImageType::SizeType SizeType;
if (m_InputImage.IsNull())
{
...
...
@@ -132,24 +133,28 @@ VectorDataIntoImageProjectionFilter<TInputVectorData, TInputImage>
std::cout << "ProjRef of the input vector data: "<< this->GetInput()->GetProjectionRef() << std::endl; */
// Get the index of the corner of the image
IndexType ul, ur, ll, lr;
PointType pul, pur, pll, plr;
ul = m_InputImage->GetLargestPossibleRegion().GetIndex();
ur = ul;
ll = ul;
lr = ul;
ur[0] += m_InputImage->GetLargestPossibleRegion().GetSize()[0];
lr[0] += m_InputImage->GetLargestPossibleRegion().GetSize()[0];
lr[1] += m_InputImage->GetLargestPossibleRegion().GetSize()[1];
ll[1] += m_InputImage->GetLargestPossibleRegion().GetSize()[1];
itk::ContinuousIndex<double,2> ul(m_InputImage->GetLargestPossibleRegion().GetIndex());
ul[0] += -0.5;
ul[1] += -0.5;
itk::ContinuousIndex<double,2> ur(ul);
itk::ContinuousIndex<double,2> ll(ul);
itk::ContinuousIndex<double,2> lr(ul);
SizeType size = m_InputImage->GetLargestPossibleRegion().GetSize();
ur[0] += size[0];
lr[0] += size[0];
lr[1] += size[1];
ll[1] += size[1];
//std::cout << "bounding box of the input image (pixel): "<< ur << ", " << ul << ", " << lr << ", " << ll << std::endl;
// Transform to physical point
m_InputImage->TransformIndexToPhysicalPoint(ul, pul);
m_InputImage->TransformIndexToPhysicalPoint(ur, pur);
m_InputImage->TransformIndexToPhysicalPoint(ll, pll);
m_InputImage->TransformIndexToPhysicalPoint(lr, plr);
m_InputImage->Transform
Continuous
IndexToPhysicalPoint(ul, pul);
m_InputImage->Transform
Continuous
IndexToPhysicalPoint(ur, pur);
m_InputImage->Transform
Continuous
IndexToPhysicalPoint(ll, pll);
m_InputImage->Transform
Continuous
IndexToPhysicalPoint(lr, plr);
//std::cout << "bounding box of the input image (physical): "<< pur << ", " << pul << ", " << plr << ", " << pll << std::endl;
// Build the cartographic region
...
...
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