Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
758fc675
Commit
758fc675
authored
Feb 20, 2011
by
Thomas White
Committed by
Thomas White
Feb 22, 2012
Browse files
hdfsee: Add --image option
parent
98a58199
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/displaywindow.c
View file @
758fc675
...
...
@@ -1112,7 +1112,8 @@ static gint displaywindow_press(GtkWidget *widget, GdkEventButton *event,
DisplayWindow
*
displaywindow_open
(
const
char
*
filename
,
const
char
*
peaks
,
int
boost
,
int
binning
,
int
cmfilter
,
int
noisefilter
,
int
colscale
)
int
noisefilter
,
int
colscale
,
const
char
*
element
)
{
DisplayWindow
*
dw
;
char
*
title
;
...
...
@@ -1163,12 +1164,22 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
if
(
dw
->
hdfile
==
NULL
)
{
ERROR
(
"Couldn't open file '%s'
\n
"
,
filename
);
displaywindow_disable
(
dw
);
}
else
if
(
hdfile_set_first_image
(
dw
->
hdfile
,
"/"
)
)
{
ERROR
(
"Couldn't select path
\n
"
);
displaywindow_disable
(
dw
);
}
else
{
dw
->
image
=
calloc
(
1
,
sizeof
(
struct
image
));
hdf5_read
(
dw
->
hdfile
,
dw
->
image
,
0
,
0
.
0
);
int
fail
=
-
1
;
if
(
element
==
NULL
)
{
fail
=
hdfile_set_first_image
(
dw
->
hdfile
,
"/"
);
}
else
{
fail
=
hdfile_set_image
(
dw
->
hdfile
,
element
);
}
if
(
!
fail
)
{
dw
->
image
=
calloc
(
1
,
sizeof
(
struct
image
));
hdf5_read
(
dw
->
hdfile
,
dw
->
image
,
0
,
0
.
0
);
}
else
{
ERROR
(
"Couldn't select path
\n
"
);
displaywindow_disable
(
dw
);
}
}
}
else
{
...
...
src/displaywindow.h
View file @
758fc675
...
...
@@ -75,7 +75,8 @@ typedef struct {
extern
DisplayWindow
*
displaywindow_open
(
const
char
*
filename
,
const
char
*
peaks
,
int
boost
,
int
binning
,
int
cmfilter
,
int
noisefilter
,
int
colscale
);
int
noisefilter
,
int
colscale
,
const
char
*
element
);
#endif
/* DISPLAYWINDOW_H */
src/hdfsee.c
View file @
758fc675
...
...
@@ -49,6 +49,8 @@ static void show_help(const char *s)
" colour : Colour scale:
\n
"
" black-blue-pink-red-orange-
\n
"
" -yellow-white.
\n
"
" -e, --image=<element> Start up displaying this image from the
\n
"
" HDF5 file. Example: /data/data0.
\n
"
"
\n
"
);
}
...
...
@@ -91,6 +93,7 @@ int main(int argc, char *argv[])
int
config_noisefilter
=
0
;
int
colscale
=
SCALE_COLOUR
;
char
*
cscale
=
NULL
;
char
*
element
=
NULL
;
/* Long options */
const
struct
option
longopts
[]
=
{
...
...
@@ -101,13 +104,14 @@ int main(int argc, char *argv[])
{
"filter-cm"
,
0
,
&
config_cmfilter
,
1
},
{
"filter-noise"
,
0
,
&
config_noisefilter
,
1
},
{
"colscale"
,
1
,
NULL
,
'c'
},
{
"image"
,
1
,
NULL
,
'e'
},
{
0
,
0
,
NULL
,
0
}
};
gtk_init
(
&
argc
,
&
argv
);
/* Short options */
while
((
c
=
getopt_long
(
argc
,
argv
,
"hp:b:i:c:"
,
while
((
c
=
getopt_long
(
argc
,
argv
,
"hp:b:i:c:
e:
"
,
longopts
,
NULL
))
!=
-
1
)
{
switch
(
c
)
{
...
...
@@ -138,6 +142,10 @@ int main(int argc, char *argv[])
cscale
=
strdup
(
optarg
);
break
;
case
'e'
:
element
=
strdup
(
optarg
);
break
;
case
0
:
break
;
...
...
@@ -169,13 +177,12 @@ int main(int argc, char *argv[])
}
free
(
cscale
);
for
(
i
=
0
;
i
<
nfiles
;
i
++
)
{
main_window_list
[
i
]
=
displaywindow_open
(
argv
[
optind
+
i
],
peaks
,
boost
,
binning
,
config_cmfilter
,
config_noisefilter
,
colscale
);
colscale
,
element
);
if
(
main_window_list
[
i
]
==
NULL
)
{
ERROR
(
"Couldn't open display window
\n
"
);
}
else
{
...
...
Write
Preview
Supports
Markdown
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