cicada 0.9.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/cicada +37 -0
- data/lib/cicada.rb +31 -0
- data/lib/cicada/cicada_main.rb +674 -0
- data/lib/cicada/correction/correction.rb +363 -0
- data/lib/cicada/correction/position_corrector.rb +501 -0
- data/lib/cicada/file_interaction.rb +377 -0
- data/lib/cicada/fitting/p3d_fitter.rb +235 -0
- data/lib/cicada/mutable_matrix.rb +133 -0
- data/lib/cicada/version.rb +33 -0
- data/spec/cicada/correction/correction_spec.rb +114 -0
- data/spec/cicada/correction/position_corrector_spec.rb +169 -0
- data/spec/cicada/file_interaction_spec.rb +58 -0
- data/spec/cicada/fitting/p3d_fitter_spec.rb +79 -0
- data/spec/cicada/mutable_matrix_spec.rb +89 -0
- data/spec/spec_helper.rb +50 -0
- metadata +137 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
#--
|
2
|
+
# /* ***** BEGIN LICENSE BLOCK *****
|
3
|
+
# *
|
4
|
+
# * Copyright (c) 2013 Colin J. Fuller
|
5
|
+
# *
|
6
|
+
# * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# * of this software and associated documentation files (the Software), to deal
|
8
|
+
# * in the Software without restriction, including without limitation the rights
|
9
|
+
# * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# * copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# * furnished to do so, subject to the following conditions:
|
12
|
+
# *
|
13
|
+
# * The above copyright notice and this permission notice shall be included in
|
14
|
+
# * all copies or substantial portions of the Software.
|
15
|
+
# *
|
16
|
+
# * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# * SOFTWARE.
|
23
|
+
# *
|
24
|
+
# * ***** END LICENSE BLOCK ***** */
|
25
|
+
#++
|
26
|
+
|
27
|
+
require 'cicada/file_interaction'
|
28
|
+
|
29
|
+
describe Cicada::Serialization do
|
30
|
+
|
31
|
+
it "should be able to serialize and unserialize a set of image objects" do
|
32
|
+
|
33
|
+
iobjs = load_iobjs
|
34
|
+
|
35
|
+
to_ser = iobjs[0,3]
|
36
|
+
|
37
|
+
ser_str = Cicada::Serialization.serialize_image_objects(to_ser)
|
38
|
+
|
39
|
+
objs_out = Cicada::Serialization.unserialize_image_objects(ser_str)
|
40
|
+
|
41
|
+
objs_out[0].getPositionForChannel(0).getEntry(0).should == to_ser[0].getPositionForChannel(0).getEntry(0)
|
42
|
+
|
43
|
+
objs_out[1].getPositionForChannel(0).getEntry(0).should == to_ser[1].getPositionForChannel(0).getEntry(0)
|
44
|
+
|
45
|
+
objs_out[2].getPositionForChannel(0).getEntry(0).should == to_ser[2].getPositionForChannel(0).getEntry(0)
|
46
|
+
|
47
|
+
objs_out[0].nil?.should be false
|
48
|
+
|
49
|
+
objs_out[1].nil?.should be false
|
50
|
+
|
51
|
+
objs_out[2].nil?.should be false
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# /* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
# *
|
3
|
+
# * Copyright (c) 2013 Colin J. Fuller
|
4
|
+
# *
|
5
|
+
# * Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# * of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# * in the Software without restriction, including without limitation the rights
|
8
|
+
# * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# * copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# * furnished to do so, subject to the following conditions:
|
11
|
+
# *
|
12
|
+
# * The above copyright notice and this permission notice shall be included in
|
13
|
+
# * all copies or substantial portions of the Software.
|
14
|
+
# *
|
15
|
+
# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# * SOFTWARE.
|
22
|
+
# *
|
23
|
+
# * ***** END LICENSE BLOCK ***** */
|
24
|
+
|
25
|
+
require 'cicada/fitting/p3d_fitter'
|
26
|
+
|
27
|
+
|
28
|
+
describe Cicada::P3DFitter do
|
29
|
+
|
30
|
+
before :each do
|
31
|
+
@fitter = Cicada::P3DFitter.new({})
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should calculate p3d probability densities correctly" do
|
35
|
+
|
36
|
+
r = 10.0
|
37
|
+
m = 5.0
|
38
|
+
s = 10.0
|
39
|
+
|
40
|
+
expected = 0.04451
|
41
|
+
|
42
|
+
allowed_error = 0.00001
|
43
|
+
|
44
|
+
fct = Cicada::P3DObjectiveFunction.new
|
45
|
+
|
46
|
+
(fct.p3d(r, m, s) - expected).abs.should be < allowed_error
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should fit a p3d distribution correctly" do
|
52
|
+
|
53
|
+
data = nil
|
54
|
+
|
55
|
+
File.open("spec/resources/test_p3d_data.txt") do |f|
|
56
|
+
data = f.readlines
|
57
|
+
end
|
58
|
+
|
59
|
+
data.map! { |e| e.to_f }
|
60
|
+
|
61
|
+
result = @fitter.fit(nil, data)
|
62
|
+
|
63
|
+
expected_m = 30.0
|
64
|
+
expected_s = 10.0
|
65
|
+
|
66
|
+
allowed_error = 1.0
|
67
|
+
|
68
|
+
m = result[0]
|
69
|
+
s = result[1]
|
70
|
+
|
71
|
+
(m - expected_m).abs.should be < allowed_error
|
72
|
+
(s - expected_s).abs.should be < allowed_error
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#--
|
2
|
+
# /* ***** BEGIN LICENSE BLOCK *****
|
3
|
+
# *
|
4
|
+
# * Copyright (c) 2013 Colin J. Fuller
|
5
|
+
# *
|
6
|
+
# * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# * of this software and associated documentation files (the Software), to deal
|
8
|
+
# * in the Software without restriction, including without limitation the rights
|
9
|
+
# * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# * copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# * furnished to do so, subject to the following conditions:
|
12
|
+
# *
|
13
|
+
# * The above copyright notice and this permission notice shall be included in
|
14
|
+
# * all copies or substantial portions of the Software.
|
15
|
+
# *
|
16
|
+
# * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# * SOFTWARE.
|
23
|
+
# *
|
24
|
+
# * ***** END LICENSE BLOCK ***** */
|
25
|
+
#++
|
26
|
+
|
27
|
+
require 'cicada/mutable_matrix'
|
28
|
+
|
29
|
+
describe MMatrix do
|
30
|
+
|
31
|
+
before :each do
|
32
|
+
|
33
|
+
@mat = MMatrix[[1,2], [3,4]]
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should allow setting of individual entries" do
|
38
|
+
|
39
|
+
@mat[0,1] = 5
|
40
|
+
|
41
|
+
@mat[0,1].should == 5
|
42
|
+
@mat[0,0].should == 1
|
43
|
+
@mat[1,1].should == 4
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should allow replacement of rows" do
|
48
|
+
|
49
|
+
@mat.replace_row(0, [5,6])
|
50
|
+
|
51
|
+
@mat[0,0].should == 5
|
52
|
+
@mat[0,1].should == 6
|
53
|
+
@mat[1,0].should == 3
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should allow replacement of columns" do
|
58
|
+
|
59
|
+
@mat.replace_column(0, [5,6])
|
60
|
+
|
61
|
+
@mat[0,0].should == 5
|
62
|
+
@mat[1,0].should == 6
|
63
|
+
@mat[0,1].should == 2
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
describe MVector do
|
70
|
+
|
71
|
+
before :each do
|
72
|
+
|
73
|
+
@vec = MVector.zero(3)
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should allow setting of individual entries" do
|
78
|
+
|
79
|
+
@vec[0] = 1
|
80
|
+
|
81
|
+
@vec[0].should == 1
|
82
|
+
|
83
|
+
@vec[1].should == 0
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#--
|
2
|
+
# /* ***** BEGIN LICENSE BLOCK *****
|
3
|
+
# *
|
4
|
+
# * Copyright (c) 2013 Colin J. Fuller
|
5
|
+
# *
|
6
|
+
# * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# * of this software and associated documentation files (the Software), to deal
|
8
|
+
# * in the Software without restriction, including without limitation the rights
|
9
|
+
# * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# * copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# * furnished to do so, subject to the following conditions:
|
12
|
+
# *
|
13
|
+
# * The above copyright notice and this permission notice shall be included in
|
14
|
+
# * all copies or substantial portions of the Software.
|
15
|
+
# *
|
16
|
+
# * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# * SOFTWARE.
|
23
|
+
# *
|
24
|
+
# * ***** END LICENSE BLOCK ***** */
|
25
|
+
#++
|
26
|
+
|
27
|
+
#resource locations for test data
|
28
|
+
|
29
|
+
CORR_IMAGE = "./spec/resources/beads_sim.ome.tif"
|
30
|
+
|
31
|
+
CORR_MASK = "./spec/resources/beads_sim_mask.ome.tif"
|
32
|
+
|
33
|
+
OBJ_FN = "./spec/resources/beads_sim_data.xml"
|
34
|
+
|
35
|
+
CORR_FN = "./spec/resources/sim_correction.xml"
|
36
|
+
|
37
|
+
def load_correction
|
38
|
+
|
39
|
+
Cicada::Correction.read_from_file(CORR_FN)
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def load_iobjs
|
45
|
+
|
46
|
+
Cicada::FileInteraction.unserialize_position_data_file(OBJ_FN)
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cicada
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
prerelease:
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Colin J. Fuller
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pqueue
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: !binary |-
|
21
|
+
MA==
|
22
|
+
none: false
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: !binary |-
|
28
|
+
MA==
|
29
|
+
none: false
|
30
|
+
prerelease: false
|
31
|
+
type: :runtime
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: facets
|
34
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: !binary |-
|
39
|
+
MA==
|
40
|
+
none: false
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: !binary |-
|
46
|
+
MA==
|
47
|
+
none: false
|
48
|
+
prerelease: false
|
49
|
+
type: :runtime
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rimageanalysistools
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: !binary |-
|
57
|
+
MA==
|
58
|
+
none: false
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: !binary |-
|
64
|
+
MA==
|
65
|
+
none: false
|
66
|
+
prerelease: false
|
67
|
+
type: :runtime
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rspec
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: !binary |-
|
75
|
+
MA==
|
76
|
+
none: false
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: !binary |-
|
82
|
+
MA==
|
83
|
+
none: false
|
84
|
+
prerelease: false
|
85
|
+
type: :development
|
86
|
+
description: CICADA (Colocalization and In-situ Correction of Aberration for Distance Analysis) implementation; see Fuller and Straight J. Microscopy (2012) doi:10.1111/j.1365-2818.2012.03654.x
|
87
|
+
email: cjfuller@gmail.com
|
88
|
+
executables:
|
89
|
+
- cicada
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- lib/cicada.rb
|
94
|
+
- lib/cicada/cicada_main.rb
|
95
|
+
- lib/cicada/file_interaction.rb
|
96
|
+
- lib/cicada/mutable_matrix.rb
|
97
|
+
- lib/cicada/version.rb
|
98
|
+
- lib/cicada/correction/position_corrector.rb
|
99
|
+
- lib/cicada/correction/correction.rb
|
100
|
+
- lib/cicada/fitting/p3d_fitter.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
- spec/cicada/file_interaction_spec.rb
|
103
|
+
- spec/cicada/mutable_matrix_spec.rb
|
104
|
+
- spec/cicada/correction/position_corrector_spec.rb
|
105
|
+
- spec/cicada/correction/correction_spec.rb
|
106
|
+
- spec/cicada/fitting/p3d_fitter_spec.rb
|
107
|
+
- bin/cicada
|
108
|
+
homepage: http://github.com/cjfuller/cicada
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: !binary |-
|
120
|
+
MA==
|
121
|
+
none: false
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: !binary |-
|
127
|
+
MA==
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- jruby
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 1.8.24
|
133
|
+
signing_key:
|
134
|
+
specification_version: 3
|
135
|
+
summary: CICADA implementation
|
136
|
+
test_files: []
|
137
|
+
has_rdoc:
|