Squiz Matrix
4.12.2
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
All
Data Structures
Namespaces
Functions
Variables
Pages
Filters.java
1
package
ij.plugin.filter;
2
import
ij.*;
3
import
ij.gui.*;
4
import
ij.process.*;
5
import
java.awt.*;
6
9
public
class
Filters
implements
PlugInFilter
{
10
11
private
static
double
sd =
Prefs
.
getDouble
(
Prefs
.NOISE_SD, 25.0);
12
private
String arg;
13
private
ImagePlus
imp;
14
private
int
slice;
15
private
boolean
canceled;
16
17
public
int
setup
(String arg,
ImagePlus
imp) {
18
this.arg = arg;
19
this.imp = imp;
20
if
(imp!=null) {
21
Roi roi = imp.getRoi();
22
if
(roi!=null && !roi.isArea())
23
imp.
killRoi
();
// ignore any line selection
24
}
25
return
IJ
.
setupDialog
(imp,
DOES_ALL
-
DOES_8C
+
SUPPORTS_MASKING
);
26
}
27
28
public
void
run
(ImageProcessor ip) {
29
30
if
(arg.equals(
"invert"
)) {
31
ip.invert();
32
return
;
33
}
34
35
if
(arg.equals(
"smooth"
)) {
36
ip.smooth();
37
return
;
38
}
39
40
if
(arg.equals(
"sharpen"
)) {
41
ip.sharpen();
42
return
;
43
}
44
45
if
(arg.equals(
"edge"
)) {
46
ip.findEdges();
47
return
;
48
}
49
50
if
(arg.equals(
"add"
)) {
51
ip.noise(25.0);
52
return
;
53
}
54
55
if
(arg.equals(
"noise"
)) {
56
if
(canceled)
57
return
;
58
slice++;
59
if
(slice==1) {
60
GenericDialog gd =
new
GenericDialog(
"Gaussian Noise"
);
61
gd.addNumericField(
"Standard Deviation:"
, sd, 2);
62
gd.showDialog();
63
if
(gd.wasCanceled()) {
64
canceled =
true
;
65
return
;
66
}
67
sd = gd.getNextNumber();
68
}
69
ip.noise(sd);
70
IJ
.
register
(
Filters
.class);
71
return
;
72
}
73
74
}
75
77
public
static
double
getSD
() {
78
return
sd;
79
}
80
81
}
squiz_matrix
fudge
image_editor
src
ij
plugin
filter
Filters.java
Generated on Tue Jan 29 2013 14:04:51 for Squiz Matrix by
1.8.3.1