Skip to content
GitLab
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
88c08418
Commit
88c08418
authored
Mar 18, 2010
by
Thomas White
Browse files
Separate CM subtraction and noise filter
parent
7678f34a
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/displaywindow.c
View file @
88c08418
...
...
@@ -982,7 +982,8 @@ static gint displaywindow_press(GtkWidget *widget, GdkEventButton *event,
DisplayWindow
*
displaywindow_open
(
const
char
*
filename
,
const
char
*
peaks
,
int
boost
,
int
binning
,
int
clean
)
int
boost
,
int
binning
,
int
cmfilter
,
int
noisefilter
)
{
DisplayWindow
*
dw
;
char
*
title
;
...
...
@@ -1048,7 +1049,8 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
dw
->
binning
=
binning
;
dw
->
boostint
=
boost
;
dw
->
clean
=
clean
;
dw
->
cmfilter
=
cmfilter
;
dw
->
noisefilter
=
noisefilter
;
displaywindow_update
(
dw
);
/* Peak list provided at startup? */
...
...
src/displaywindow.h
View file @
88c08418
...
...
@@ -63,7 +63,8 @@ typedef struct {
int
height
;
/* Size of the drawing area */
int
binning
;
int
boostint
;
int
clean
;
/* Whether or not to clean the image */
int
cmfilter
;
/* Use CM subtraction */
int
noisefilter
;
/* Use aggressive noise filter */
int
show_col_scale
;
int
scale
;
...
...
@@ -74,7 +75,8 @@ typedef struct {
/* Open an image display window showing the given filename, or NULL */
extern
DisplayWindow
*
displaywindow_open
(
const
char
*
filename
,
const
char
*
peaks
,
int
boost
,
int
binning
,
int
clean
);
int
binning
,
int
cmfilter
,
int
noisefilter
);
#endif
/* DISPLAYWINDOW_H */
src/filters.c
View file @
88c08418
...
...
@@ -97,7 +97,7 @@ static void noise_filter(struct image *image)
/* Pre-processing to make life easier */
void
clean_image
(
struct
image
*
image
)
void
filter_cm
(
struct
image
*
image
)
{
int
px
,
py
;
...
...
@@ -111,5 +111,10 @@ void clean_image(struct image *image)
}
}
}
void
filter_noise
(
struct
image
*
image
)
{
noise_filter
(
image
);
}
src/filters.h
View file @
88c08418
...
...
@@ -18,6 +18,8 @@
#endif
extern
void
clean_image
(
struct
image
*
image
);
extern
void
filter_cm
(
struct
image
*
image
);
extern
void
filter_noise
(
struct
image
*
image
);
#endif
/* FILTERS_H */
src/hdfsee.c
View file @
88c08418
...
...
@@ -38,9 +38,11 @@ static void show_help(const char *s)
" -p, --peak-overlay=<filename> Draw circles in positions listed in file.
\n
"
" -i, --int-boost=<n> Multiply intensity by <n>.
\n
"
" -b, --binning=<n> Set display binning to <n>.
\n
"
" --clean-image Perform common-mode noise subtraction and
\n
"
" background removal on images before
\n
"
" proceeding.
\n
"
" --filter-cm Perform common-mode noise subtraction.
\n
"
" --filter-noise Apply an aggressive noise filter which
\n
"
" sets all pixels in each 3x3 region to
\n
"
" zero if any of them have negative
\n
"
" values.
\n
"
"
\n
"
);
}
...
...
@@ -79,7 +81,8 @@ int main(int argc, char *argv[])
char
*
peaks
=
NULL
;
int
boost
=
1
;
int
binning
=
2
;
int
config_clean
=
0
;
int
config_cmfilter
=
0
;
int
config_noisefilter
=
0
;
/* Long options */
const
struct
option
longopts
[]
=
{
...
...
@@ -87,7 +90,8 @@ int main(int argc, char *argv[])
{
"peak-overlay"
,
1
,
NULL
,
'p'
},
{
"int-boost"
,
1
,
NULL
,
'i'
},
{
"binning"
,
1
,
NULL
,
'b'
},
{
"clean-image"
,
0
,
&
config_clean
,
1
},
{
"filter-cm"
,
0
,
&
config_cmfilter
,
1
},
{
"filter-noise"
,
0
,
&
config_noisefilter
,
1
},
{
0
,
0
,
NULL
,
0
}
};
...
...
@@ -145,7 +149,8 @@ int main(int argc, char *argv[])
for
(
i
=
0
;
i
<
nfiles
;
i
++
)
{
main_window_list
[
i
]
=
displaywindow_open
(
argv
[
optind
+
i
],
peaks
,
boost
,
binning
,
config_clean
);
config_cmfilter
,
config_noisefilter
);
if
(
main_window_list
[
i
]
==
NULL
)
{
ERROR
(
"Couldn't open display window
\n
"
);
}
else
{
...
...
src/indexamajig.c
View file @
88c08418
...
...
@@ -49,6 +49,8 @@ static void show_help(const char *s)
" dirax : invoke DirAx
\n
"
"
\n
"
" --verbose Be verbose about indexing.
\n
"
" --gpu Use the GPU to speed up the simulation.
\n
"
"
\n
"
" --write-drx Write 'xfel.drx' for visualisation of reciprocal
\n
"
" space. Implied by any indexing method other than
\n
"
" 'none'. Beware: the units in this file are
\n
"
...
...
@@ -57,9 +59,13 @@ static void show_help(const char *s)
" --near-bragg Output a list of reflection intensities to stdout.
\n
"
" --simulate Simulate the diffraction pattern using the indexed
\n
"
" unit cell.
\n
"
" --gpu Use the GPU to speed up the simulation.
\n
"
" --clean-image Perform common-mode noise subtraction and
\n
"
" background removal on images before proceeding.
\n
"
" --filter-cm Perform common-mode noise subtraction on images
\n
"
" before proceeding. Intensities will be extracted
\n
"
" from the image as it is after this processing.
\n
"
" --filter-noise Apply an aggressive noise filter which sets all
\n
"
" pixels in each 3x3 region to zero if any of them
\n
"
" have negative values. Intensity measurement will
\n
"
" be performed on the image as it was before this.
\n
"
" --no-match Don't attempt to match the indexed cell to the
\n
"
" model, just proceed with the one generated by the
\n
"
" auto-indexing procedure.
\n
"
...
...
@@ -170,7 +176,8 @@ int main(int argc, char *argv[])
int
config_nearbragg
=
0
;
int
config_writedrx
=
0
;
int
config_simulate
=
0
;
int
config_clean
=
0
;
int
config_cmfilter
=
0
;
int
config_noisefilter
=
0
;
int
config_nomatch
=
0
;
int
config_gpu
=
0
;
int
config_verbose
=
0
;
...
...
@@ -190,7 +197,8 @@ int main(int argc, char *argv[])
{
"write-drx"
,
0
,
&
config_writedrx
,
1
},
{
"indexing"
,
1
,
NULL
,
'z'
},
{
"simulate"
,
0
,
&
config_simulate
,
1
},
{
"clean-image"
,
0
,
&
config_clean
,
1
},
{
"filter-cm"
,
0
,
&
config_cmfilter
,
1
},
{
"filter-noise"
,
0
,
&
config_noisefilter
,
1
},
{
"no-match"
,
0
,
&
config_nomatch
,
1
},
{
"verbose"
,
0
,
&
config_verbose
,
1
},
{
"alternate"
,
0
,
&
config_alternate
,
1
},
...
...
@@ -296,8 +304,8 @@ int main(int argc, char *argv[])
hdf5_read
(
hdfile
,
&
image
);
if
(
config_c
lean
)
{
clean_image
(
&
image
);
if
(
config_c
mfilter
)
{
filter_cm
(
&
image
);
}
/* Perform 'fine' peak search */
...
...
src/render.c
View file @
88c08418
...
...
@@ -77,7 +77,8 @@ float *render_get_image_binned(DisplayWindow *dw, int binning, float *max)
hdf5_read
(
dw
->
hdfile
,
image
);
dw
->
image_dirty
=
0
;
if
(
dw
->
clean
)
clean_image
(
image
);
if
(
dw
->
cmfilter
)
filter_cm
(
image
);
if
(
dw
->
noisefilter
)
filter_noise
(
image
);
/* Deal with the old image, if existing */
if
(
dw
->
image
!=
NULL
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment