Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
af6a5b25
Commit
af6a5b25
authored
3 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
replace deprecated uint8 by int8_t etc etc
parent
09472c31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!443
get rid of new warnings from gcc-11
Pipeline
#49025
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Device/InputOutput/OutputDataReadWriteTiff.cpp
+16
-16
16 additions, 16 deletions
Device/InputOutput/OutputDataReadWriteTiff.cpp
Device/InputOutput/OutputDataReadWriteTiff.h
+2
-1
2 additions, 1 deletion
Device/InputOutput/OutputDataReadWriteTiff.h
with
18 additions
and
17 deletions
Device/InputOutput/OutputDataReadWriteTiff.cpp
+
16
−
16
View file @
af6a5b25
...
...
@@ -68,8 +68,8 @@ void OutputDataReadWriteTiff::writeOutputData(const OutputData<double>& data,
void
OutputDataReadWriteTiff
::
read_header
()
{
ASSERT
(
m_tiff
);
uint32
width
(
0
);
uint32
height
(
0
);
uint32
_t
width
(
0
);
uint32
_t
height
(
0
);
if
(
!
TIFFGetField
(
m_tiff
,
TIFFTAG_IMAGEWIDTH
,
&
width
)
||
!
TIFFGetField
(
m_tiff
,
TIFFTAG_IMAGELENGTH
,
&
height
))
{
throw
std
::
runtime_error
(
"OutputDataReadWriteTiff::read_header() -> Error. "
...
...
@@ -79,7 +79,7 @@ void OutputDataReadWriteTiff::read_header()
m_width
=
(
size_t
)
width
;
m_height
=
(
size_t
)
height
;
uint16
orientationTag
(
0
);
uint16
_t
orientationTag
(
0
);
TIFFGetField
(
m_tiff
,
TIFFTAG_ORIENTATION
,
&
orientationTag
);
bool
good
=
true
;
...
...
@@ -127,7 +127,7 @@ void OutputDataReadWriteTiff::read_data()
ASSERT
(
m_tiff
);
ASSERT
(
0
==
m_bitsPerSample
%
8
);
uint16
bytesPerSample
=
m_bitsPerSample
/
8
;
uint16
_t
bytesPerSample
=
m_bitsPerSample
/
8
;
tmsize_t
buf_size
=
TIFFScanlineSize
(
m_tiff
);
tmsize_t
expected_size
=
bytesPerSample
*
m_width
;
if
(
buf_size
!=
expected_size
)
...
...
@@ -141,12 +141,12 @@ void OutputDataReadWriteTiff::read_data()
create_output_data
();
std
::
vector
<
int8
>
line_buf
;
std
::
vector
<
int8
_t
>
line_buf
;
line_buf
.
resize
(
buf_size
,
0
);
std
::
vector
<
unsigned
>
axes_indices
(
2
);
for
(
uint32
row
=
0
;
row
<
(
uint32
)
m_height
;
row
++
)
{
for
(
uint32
_t
row
=
0
;
row
<
(
uint32
_t
)
m_height
;
row
++
)
{
if
(
TIFFReadScanline
(
m_tiff
,
buf
,
row
)
<
0
)
throw
std
::
runtime_error
(
"OutputDataReadWriteTiff::read_data() -> Error. Error in scanline."
);
...
...
@@ -165,26 +165,26 @@ void OutputDataReadWriteTiff::read_data()
case
1
:
// unsigned int
switch
(
m_bitsPerSample
)
{
case
8
:
sample
=
*
reinterpret_cast
<
uint8
*>
(
incoming
);
sample
=
*
reinterpret_cast
<
uint8
_t
*>
(
incoming
);
break
;
case
16
:
sample
=
*
reinterpret_cast
<
uint16
*>
(
incoming
);
sample
=
*
reinterpret_cast
<
uint16
_t
*>
(
incoming
);
break
;
case
32
:
sample
=
*
reinterpret_cast
<
uint32
*>
(
incoming
);
sample
=
*
reinterpret_cast
<
uint32
_t
*>
(
incoming
);
break
;
}
break
;
case
2
:
// signed int
switch
(
m_bitsPerSample
)
{
case
8
:
sample
=
*
reinterpret_cast
<
int8
*>
(
incoming
);
sample
=
*
reinterpret_cast
<
int8
_t
*>
(
incoming
);
break
;
case
16
:
sample
=
*
reinterpret_cast
<
int16
*>
(
incoming
);
sample
=
*
reinterpret_cast
<
int16
_t
*>
(
incoming
);
break
;
case
32
:
sample
=
*
reinterpret_cast
<
int32
*>
(
incoming
);
sample
=
*
reinterpret_cast
<
int32
_t
*>
(
incoming
);
break
;
}
break
;
...
...
@@ -210,13 +210,13 @@ void OutputDataReadWriteTiff::write_header()
"Image converted from BornAgain intensity file."
);
TIFFSetField
(
m_tiff
,
TIFFTAG_SOFTWARE
,
"BornAgain"
);
uint32
width
=
static_cast
<
uint32
>
(
m_width
);
uint32
height
=
static_cast
<
uint32
>
(
m_height
);
uint32
_t
width
=
static_cast
<
uint32
_t
>
(
m_width
);
uint32
_t
height
=
static_cast
<
uint32
_t
>
(
m_height
);
TIFFSetField
(
m_tiff
,
TIFFTAG_IMAGEWIDTH
,
width
);
TIFFSetField
(
m_tiff
,
TIFFTAG_IMAGELENGTH
,
height
);
// output format, hardcoded here
uint16
bitPerSample
=
32
,
samplesPerPixel
=
1
;
uint16
_t
bitPerSample
=
32
,
samplesPerPixel
=
1
;
TIFFSetField
(
m_tiff
,
TIFFTAG_BITSPERSAMPLE
,
bitPerSample
);
TIFFSetField
(
m_tiff
,
TIFFTAG_SAMPLESPERPIXEL
,
samplesPerPixel
);
...
...
@@ -235,7 +235,7 @@ void OutputDataReadWriteTiff::write_data()
std
::
vector
<
sample_t
>
line_buf
;
line_buf
.
resize
(
m_width
,
0
);
std
::
vector
<
unsigned
>
axes_indices
(
2
);
for
(
unsigned
row
=
0
;
row
<
(
uint32
)
m_height
;
row
++
)
{
for
(
unsigned
row
=
0
;
row
<
(
uint32
_t
)
m_height
;
row
++
)
{
for
(
unsigned
col
=
0
;
col
<
line_buf
.
size
();
++
col
)
{
axes_indices
[
0
]
=
col
;
axes_indices
[
1
]
=
static_cast
<
unsigned
>
(
m_height
)
-
1
-
row
;
...
...
This diff is collapsed.
Click to expand it.
Device/InputOutput/OutputDataReadWriteTiff.h
+
2
−
1
View file @
af6a5b25
...
...
@@ -25,6 +25,7 @@
#include
"Device/Data/OutputData.h"
#include
<memory>
#include
<tiffio.h>
#include
<cstdint>
//! Reads/write tiff files.
...
...
@@ -47,7 +48,7 @@ private:
TIFF
*
m_tiff
;
size_t
m_width
,
m_height
;
uint16
m_bitsPerSample
,
m_samplesPerPixel
,
m_sampleFormat
;
uint16
_t
m_bitsPerSample
,
m_samplesPerPixel
,
m_sampleFormat
;
std
::
unique_ptr
<
OutputData
<
double
>>
m_data
;
};
...
...
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