Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Youssefi
otb
Commits
295829f6
Commit
295829f6
authored
Jul 03, 2020
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: implement GetCorner() methods in Image and VectorImage
parent
b4e73c1b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
17 deletions
+115
-17
Modules/Core/ImageBase/include/otbImage.h
Modules/Core/ImageBase/include/otbImage.h
+8
-0
Modules/Core/ImageBase/include/otbImage.hxx
Modules/Core/ImageBase/include/otbImage.hxx
+48
-0
Modules/Core/ImageBase/include/otbImageCommons.h
Modules/Core/ImageBase/include/otbImageCommons.h
+0
-9
Modules/Core/ImageBase/include/otbVectorImage.h
Modules/Core/ImageBase/include/otbVectorImage.h
+9
-0
Modules/Core/ImageBase/include/otbVectorImage.hxx
Modules/Core/ImageBase/include/otbVectorImage.hxx
+50
-1
Modules/Core/ImageBase/src/otbImageCommons.cxx
Modules/Core/ImageBase/src/otbImageCommons.cxx
+0
-7
No files found.
Modules/Core/ImageBase/include/otbImage.h
View file @
295829f6
...
...
@@ -199,6 +199,14 @@ public:
/** Get the six coefficients of affine geoTtransform. */
virtual
VectorType
GetGeoTransform
(
void
)
const
;
/** Get image corners. */
// TODO: GenericRSTransform should be instanciated to translate from physical
// space to EPSG:4328 ?
VectorType
GetUpperLeftCorner
(
void
)
const
;
VectorType
GetUpperRightCorner
(
void
)
const
;
VectorType
GetLowerLeftCorner
(
void
)
const
;
VectorType
GetLowerRightCorner
(
void
)
const
;
/** Get signed spacing */
SpacingType
GetSignedSpacing
()
const
;
...
...
Modules/Core/ImageBase/include/otbImage.hxx
View file @
295829f6
...
...
@@ -153,6 +153,54 @@ typename Image<TPixel, VImageDimension>::VectorType Image<TPixel, VImageDimensio
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
Image
<
TPixel
,
VImageDimension
>::
VectorType
Image
<
TPixel
,
VImageDimension
>::
GetUpperLeftCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
Image
<
TPixel
,
VImageDimension
>::
VectorType
Image
<
TPixel
,
VImageDimension
>::
GetUpperRightCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
index
[
0
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
0
];
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
Image
<
TPixel
,
VImageDimension
>::
VectorType
Image
<
TPixel
,
VImageDimension
>::
GetLowerLeftCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
index
[
1
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
1
];
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
Image
<
TPixel
,
VImageDimension
>::
VectorType
Image
<
TPixel
,
VImageDimension
>::
GetLowerRightCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
index
[
0
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
0
];
index
[
1
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
1
];
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
void
Image
<
TPixel
,
VImageDimension
>::
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
{
...
...
Modules/Core/ImageBase/include/otbImageCommons.h
View file @
295829f6
...
...
@@ -63,15 +63,6 @@ public:
double
GetGCPY
(
unsigned
int
GCPnum
)
const
;
double
GetGCPZ
(
unsigned
int
GCPnum
)
const
;
/** Get image corners. */
// TODO: move back to Image and VectorImage, compute corners in physical space,
// Then a GenericRSTransform should be instanciated to translate from physical
// space to EPSG:4328
ImageMetadataInterfaceBase
::
VectorType
GetUpperLeftCorner
(
void
)
const
;
ImageMetadataInterfaceBase
::
VectorType
GetUpperRightCorner
(
void
)
const
;
ImageMetadataInterfaceBase
::
VectorType
GetLowerLeftCorner
(
void
)
const
;
ImageMetadataInterfaceBase
::
VectorType
GetLowerRightCorner
(
void
)
const
;
/** Returns true if a sensor geometric model is present */
bool
HasSensorGeometry
()
const
;
...
...
Modules/Core/ImageBase/include/otbVectorImage.h
View file @
295829f6
...
...
@@ -125,6 +125,15 @@ public:
/** Get the six coefficients of affine geoTtransform. */
virtual
VectorType
GetGeoTransform
(
void
)
const
;
/** Get image corners. */
// TODO: GenericRSTransform should be instanciated to translate from physical
// space to EPSG:4328 ?
VectorType
GetUpperLeftCorner
(
void
)
const
;
VectorType
GetUpperRightCorner
(
void
)
const
;
VectorType
GetLowerLeftCorner
(
void
)
const
;
VectorType
GetLowerRightCorner
(
void
)
const
;
/** Get signed spacing */
SpacingType
GetSignedSpacing
()
const
;
...
...
Modules/Core/ImageBase/include/otbVectorImage.hxx
View file @
295829f6
...
...
@@ -112,7 +112,7 @@ void VectorImage<TPixel, VImageDimension>::CopyInformation(const itk::DataObject
if
(
imc
!=
nullptr
)
{
const
auto
&
imd
=
imc
->
GetImageMetadata
();
std
::
cout
<<
"hello "
<<
this
->
GetNumberOfComponentsPerPixel
()
<<
std
::
endl
;
if
(
imd
.
Bands
.
size
()
>
0
&&
imd
.
Bands
.
size
()
!=
this
->
GetNumberOfComponentsPerPixel
())
{
SetImageMetadata
(
ImageMetadata
(
imd
.
GeometryKeys
,
imd
.
NumericKeys
,
imd
.
StringKeys
,
imd
.
LUT1DKeys
,
...
...
@@ -157,6 +157,55 @@ typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VI
return
(
geoTransform
);
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
VectorImage
<
TPixel
,
VImageDimension
>::
VectorType
VectorImage
<
TPixel
,
VImageDimension
>::
GetUpperLeftCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
VectorImage
<
TPixel
,
VImageDimension
>::
VectorType
VectorImage
<
TPixel
,
VImageDimension
>::
GetUpperRightCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
index
[
0
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
0
];
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
VectorImage
<
TPixel
,
VImageDimension
>::
VectorType
VectorImage
<
TPixel
,
VImageDimension
>::
GetLowerLeftCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
index
[
1
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
1
];
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
VectorImage
<
TPixel
,
VImageDimension
>::
VectorType
VectorImage
<
TPixel
,
VImageDimension
>::
GetLowerRightCorner
(
void
)
const
{
PointType
physicalPoint
;
itk
::
ContinuousIndex
<
double
,
VImageDimension
>
index
;
index
.
Fill
(
-
0.5
);
index
[
0
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
0
];
index
[
1
]
=
-
0.5
+
this
->
GetLargestPossibleRegion
().
GetSize
()[
1
];
this
->
TransformContinuousIndexToPhysicalPoint
(
index
,
physicalPoint
)
;
return
{
physicalPoint
[
0
],
physicalPoint
[
1
]};
}
template
<
class
TPixel
,
unsigned
int
VImageDimension
>
typename
VectorImage
<
TPixel
,
VImageDimension
>::
ImageMetadataInterfacePointerType
VectorImage
<
TPixel
,
VImageDimension
>::
GetMetaDataInterface
()
const
{
...
...
Modules/Core/ImageBase/src/otbImageCommons.cxx
View file @
295829f6
...
...
@@ -121,13 +121,6 @@ double ImageCommons::GetGCPZ(unsigned int GCPnum) const
}
ImageMetadataInterfaceBase
::
VectorType
ImageCommons
::
GetUpperLeftCorner
(
void
)
const
{
//~ return {m_Imd.ULX, m_Imd.ULY};
return
{};
}
ImageMetadataInterfaceBase
::
VectorType
ImageCommons
::
GetUpperRightCorner
(
void
)
const
{
//~ return {m_Imd.URX, m_Imd.URY};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment