Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
d2b79a76
Commit
d2b79a76
authored
Dec 18, 2017
by
Locatelli
Browse files
validate again simulated tiff file reading
parent
26f515db
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/drivers/photonic/psl/PslDriver.cpp
View file @
d2b79a76
...
...
@@ -57,6 +57,8 @@ PslDriver::PslDriver(const string& name):
gain
.
init
(
this
,
SAVE
,
"gain"
);
nbFrame
.
init
(
this
,
SAVE
,
"nbFrame"
);
bpixel
.
init
(
this
,
SAVE
,
"bpixel"
);
fileSimu
.
init
(
this
,
SAVE
,
"file_simu"
);
indexSimu
.
init
(
this
,
SAVE
,
"index_simu"
);
fileDirectory
.
init
(
this
,
SAVE
,
"fileDirectory"
);
fileName
.
init
(
this
,
SAVE
,
"fileName"
);
numor
.
init
(
this
,
SAVE
,
"numor"
);
...
...
@@ -141,7 +143,6 @@ void PslDriver::execute(const std::string& aCommand) {
if
(
m_DoSynchroniseRead
==
true
)
{
m_SynchroniseReadActivated
=
true
;
m_SynchroniseReadTerminated
=
false
;
cout
<<
"SYNCHRONIZE_READ_COMMAND"
<<
endl
;
currentState
->
synchroniseRead
();
m_DoSynchroniseRead
=
false
;
}
...
...
src/drivers/photonic/psl/PslDriver.h
View file @
d2b79a76
...
...
@@ -84,6 +84,9 @@ public:
Property
<
bool
>
bpixel
;
Property
<
int32
>
gain
;
Property
<
std
::
string
>
fileSimu
;
Property
<
int32
>
indexSimu
;
Property
<
string
>
fileDirectory
;
Property
<
string
>
fileName
;
Property
<
int32
>
numor
;
...
...
src/drivers/photonic/psl/SimulatedPslDriver.cpp
View file @
d2b79a76
...
...
@@ -72,44 +72,44 @@ void SimulatedPslDriver::synchroniseRead() {
* read
*/
void
SimulatedPslDriver
::
read
()
{
//
int32 size = owner()->dataSize();
//
int32 *tab = owner()->data();
//
float64 sum = 0;
//
boost::filesystem::path file = owner()->fileSimu();
//
TIFF* tif = TIFFOpen(file.string().c_str(), "r");
//
if (tif) {
//
int32 dircount = 0;
//
while (dircount < owner()->indexSimu()) {
//
if (TIFFReadDirectory(tif) <= 0) break;
//
++dircount;
//
};
//
uint32 w, h;
//
int32 npixels;
//
tdata_t buf;
//
//
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
//
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
//
npixels = w * h;
//
if (npixels == size) {
//
tmsize_t scanlinesize = TIFFScanlineSize(tif);
//
buf = _TIFFmalloc(scanlinesize);
//
if (buf != NULL) {
//
uint16* data;
//
for (uint32 row = 0; row < h; row++) {
//
TIFFReadScanline(tif, buf, row, 0);
//
data = (uint16*) buf;
//
for(uint32 i = 0; i < w;++i) {
//
tab[row + i * h] = data[i];
//
sum = sum + data[i];
//
}
//
}
//
owner()->sum = sum;
//
owner()->data.sendEvent();
//
_TIFFfree(buf);
//
}
//
}
//
TIFFClose(tif);
//
}
int32
size
=
owner
()
->
dataSize
();
int32
*
tab
=
owner
()
->
data
();
float64
sum
=
0
;
boost
::
filesystem
::
path
file
=
owner
()
->
fileSimu
();
TIFF
*
tif
=
TIFFOpen
(
file
.
string
().
c_str
(),
"r"
);
if
(
tif
)
{
int32
dircount
=
0
;
while
(
dircount
<
owner
()
->
indexSimu
())
{
if
(
TIFFReadDirectory
(
tif
)
<=
0
)
break
;
++
dircount
;
};
uint32
w
,
h
;
int32
npixels
;
tdata_t
buf
;
TIFFGetField
(
tif
,
TIFFTAG_IMAGEWIDTH
,
&
w
);
TIFFGetField
(
tif
,
TIFFTAG_IMAGELENGTH
,
&
h
);
npixels
=
w
*
h
;
if
(
npixels
==
size
)
{
tmsize_t
scanlinesize
=
TIFFScanlineSize
(
tif
);
buf
=
_TIFFmalloc
(
scanlinesize
);
if
(
buf
!=
NULL
)
{
uint16
*
data
;
for
(
uint32
row
=
0
;
row
<
h
;
row
++
)
{
TIFFReadScanline
(
tif
,
buf
,
row
,
0
);
data
=
(
uint16
*
)
buf
;
for
(
uint32
i
=
0
;
i
<
w
;
++
i
)
{
tab
[
row
+
i
*
h
]
=
data
[
i
];
sum
=
sum
+
data
[
i
];
}
}
owner
()
->
sum
=
sum
;
owner
()
->
data
.
sendEvent
();
_TIFFfree
(
buf
);
}
}
TIFFClose
(
tif
);
}
// Read command
// for (int32 i = 0; i < size; i++) {
...
...
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