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
4e40a07b
Commit
4e40a07b
authored
14 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
BUG: fix GDALImageIO streaming support
parent
907cb3a1
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/IO/otbGDALImageIO.cxx
+12
-9
12 additions, 9 deletions
Code/IO/otbGDALImageIO.cxx
with
12 additions
and
9 deletions
Code/IO/otbGDALImageIO.cxx
+
12
−
9
View file @
4e40a07b
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include
"otbMacro.h"
#include
"otbMacro.h"
#include
"otbSystem.h"
#include
"otbSystem.h"
#include
"otbImage.h"
#include
"otbImage.h"
#include
"itk
Array
.h"
#include
"itk
VariableLengthVector
.h"
#include
"itkMetaDataObject.h"
#include
"itkMetaDataObject.h"
#include
"otbMetaDataKey.h"
#include
"otbMetaDataKey.h"
...
@@ -236,7 +236,7 @@ void GDALImageIO::Read(void* buffer)
...
@@ -236,7 +236,7 @@ void GDALImageIO::Read(void* buffer)
std
::
streamoff
lNbPixels
=
(
static_cast
<
std
::
streamoff
>
(
lNbColumns
))
*
(
static_cast
<
std
::
streamoff
>
(
lNbLines
));
std
::
streamoff
lNbPixels
=
(
static_cast
<
std
::
streamoff
>
(
lNbColumns
))
*
(
static_cast
<
std
::
streamoff
>
(
lNbLines
));
std
::
streamoff
lBufferSize
=
static_cast
<
std
::
streamoff
>
(
m_NbOctetPixel
)
*
lNbPixels
;
std
::
streamoff
lBufferSize
=
static_cast
<
std
::
streamoff
>
(
m_NbOctetPixel
)
*
lNbPixels
;
itk
::
Array
<
unsigned
char
>
value
(
lBufferSize
);
itk
::
VariableLengthVector
<
unsigned
char
>
value
(
lBufferSize
);
CPLErr
lCrGdal
;
CPLErr
lCrGdal
;
std
::
streamoff
cpt
(
0
);
std
::
streamoff
cpt
(
0
);
...
@@ -249,7 +249,7 @@ void GDALImageIO::Read(void* buffer)
...
@@ -249,7 +249,7 @@ void GDALImageIO::Read(void* buffer)
lFirstLine
,
lFirstLine
,
lNbColumns
,
lNbColumns
,
lNbLines
,
lNbLines
,
value
.
data_block
(
),
const_cast
<
unsigned
char
*>
(
value
.
GetDataPointer
()
),
lNbColumns
,
lNbColumns
,
lNbLines
,
lNbLines
,
m_PxType
,
m_PxType
,
...
@@ -276,7 +276,7 @@ void GDALImageIO::Read(void* buffer)
...
@@ -276,7 +276,7 @@ void GDALImageIO::Read(void* buffer)
lFirstLine
,
lFirstLine
,
lNbColumns
,
lNbColumns
,
lNbLines
,
lNbLines
,
value
.
data_block
(
),
const_cast
<
unsigned
char
*>
(
value
.
GetDataPointer
()
),
lNbColumns
,
lNbColumns
,
lNbLines
,
lNbLines
,
m_PxType
,
m_PxType
,
...
@@ -312,7 +312,7 @@ void GDALImageIO::Read(void* buffer)
...
@@ -312,7 +312,7 @@ void GDALImageIO::Read(void* buffer)
lFirstLine
,
lFirstLine
,
lNbColumns
,
lNbColumns
,
lNbLines
,
lNbLines
,
value
.
data_block
(
),
const_cast
<
unsigned
char
*>
(
value
.
GetDataPointer
()
),
lNbColumns
,
lNbColumns
,
lNbLines
,
lNbLines
,
m_PxType
,
m_PxType
,
...
@@ -793,6 +793,8 @@ void GDALImageIO::InternalReadImageInformation()
...
@@ -793,6 +793,8 @@ void GDALImageIO::InternalReadImageInformation()
bool
GDALImageIO
::
CanWriteFile
(
const
char
*
name
)
bool
GDALImageIO
::
CanWriteFile
(
const
char
*
name
)
{
{
m_FileName
=
name
;
// First check the filename
// First check the filename
if
(
name
==
NULL
)
if
(
name
==
NULL
)
{
{
...
@@ -823,6 +825,7 @@ bool GDALImageIO::CanStreamWrite()
...
@@ -823,6 +825,7 @@ bool GDALImageIO::CanStreamWrite()
// Get the GDAL format ID from the name
// Get the GDAL format ID from the name
std
::
string
gdalDriverShortName
=
FilenameToGdalDriverShortName
(
m_FileName
);
std
::
string
gdalDriverShortName
=
FilenameToGdalDriverShortName
(
m_FileName
);
GDALDriver
*
driver
=
GDALDriverManagerWrapper
::
GetInstance
().
GetDriverByName
(
gdalDriverShortName
);
GDALDriver
*
driver
=
GDALDriverManagerWrapper
::
GetInstance
().
GetDriverByName
(
gdalDriverShortName
);
if
(
driver
==
NULL
)
if
(
driver
==
NULL
)
{
{
itkDebugMacro
(
<<
"Unable to instantiate driver "
<<
gdalDriverShortName
);
itkDebugMacro
(
<<
"Unable to instantiate driver "
<<
gdalDriverShortName
);
...
@@ -873,7 +876,7 @@ void GDALImageIO::Write(const void* buffer)
...
@@ -873,7 +876,7 @@ void GDALImageIO::Write(const void* buffer)
std
::
streamoff
lBufferSize
=
static_cast
<
std
::
streamoff
>
(
m_NbOctetPixel
)
*
lNbPixels
;
std
::
streamoff
lBufferSize
=
static_cast
<
std
::
streamoff
>
(
m_NbOctetPixel
)
*
lNbPixels
;
otbMsgDevMacro
(
<<
" BufferSize allocated : "
<<
lBufferSize
);
otbMsgDevMacro
(
<<
" BufferSize allocated : "
<<
lBufferSize
);
itk
::
Array
<
unsigned
char
>
value
(
lBufferSize
);
itk
::
VariableLengthVector
<
unsigned
char
>
value
(
lBufferSize
);
if
(
m_CanStreamWrite
)
if
(
m_CanStreamWrite
)
{
{
...
@@ -895,7 +898,7 @@ void GDALImageIO::Write(const void* buffer)
...
@@ -895,7 +898,7 @@ void GDALImageIO::Write(const void* buffer)
}
}
GDALRasterBand
*
poBand
=
m_Dataset
->
GetDataSet
()
->
GetRasterBand
(
nbComponents
+
1
);
GDALRasterBand
*
poBand
=
m_Dataset
->
GetDataSet
()
->
GetRasterBand
(
nbComponents
+
1
);
lCrGdal
=
poBand
->
RasterIO
(
GF_Write
,
lFirstColumn
,
lFirstLine
,
lNbColumns
,
lNbLines
,
value
.
data_block
(
),
lCrGdal
=
poBand
->
RasterIO
(
GF_Write
,
lFirstColumn
,
lFirstLine
,
lNbColumns
,
lNbLines
,
const_cast
<
unsigned
char
*>
(
value
.
GetDataPointer
()
),
lNbColumns
,
lNbLines
,
m_PxType
,
0
,
0
);
lNbColumns
,
lNbLines
,
m_PxType
,
0
,
0
);
if
(
lCrGdal
==
CE_Failure
)
if
(
lCrGdal
==
CE_Failure
)
{
{
...
@@ -1125,7 +1128,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
...
@@ -1125,7 +1128,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
/* Set the six coefficients of affine geoTtransform */
/* Set the six coefficients of affine geoTtransform */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
itk
::
Array
<
double
>
geoTransform
(
6
);
itk
::
VariableLengthVector
<
double
>
geoTransform
(
6
);
/// Reporting origin and spacing
/// Reporting origin and spacing
geoTransform
[
0
]
=
m_Origin
[
0
];
geoTransform
[
0
]
=
m_Origin
[
0
];
geoTransform
[
3
]
=
m_Origin
[
1
];
geoTransform
[
3
]
=
m_Origin
[
1
];
...
@@ -1135,7 +1138,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
...
@@ -1135,7 +1138,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
// FIXME: Here component 1 and 4 should be replaced by the orientation parameters
// FIXME: Here component 1 and 4 should be replaced by the orientation parameters
geoTransform
[
2
]
=
0.
;
geoTransform
[
2
]
=
0.
;
geoTransform
[
4
]
=
0.
;
geoTransform
[
4
]
=
0.
;
dataset
->
SetGeoTransform
(
geoTransform
.
data_block
(
));
dataset
->
SetGeoTransform
(
const_cast
<
double
*>
(
geoTransform
.
GetDataPointer
()
));
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
/* Report metadata. */
/* Report metadata. */
...
...
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