metamri 0.2.15 → 0.2.16
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/Gemfile +1 -0
- data/bin/convert_visit.rb +1 -1
- data/lib/metamri/raw_image_dataset_thumbnail.rb +36 -2
- data/lib/metamri/version.rb +1 -1
- data/lib/metamri/visit_raw_data_directory.rb +1 -1
- data/lib/metamri.rb +1 -1
- data/metamri.gemspec +1 -1
- metadata +12 -28
data/Gemfile
CHANGED
data/bin/convert_visit.rb
CHANGED
@@ -42,7 +42,7 @@ def convert_visit(raw_directory, scan_procedure_codename, output_directory = nil
|
|
42
42
|
output_directory = output_directory ||= v.default_preprocess_directory
|
43
43
|
|
44
44
|
begin
|
45
|
-
default_options = {:ignore_patterns => [/vipr/,/900$/,/901$/,/999$/]} # seems to like number , not like string
|
45
|
+
default_options = {:ignore_patterns => [/vipr/,/900$/,/901$/,/999$/]} # seems to like number , not like string
|
46
46
|
#options = default_options.merge(options)
|
47
47
|
v.scan(default_options)
|
48
48
|
v.to_nifti!(output_directory)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'tmpdir'
|
2
2
|
begin
|
3
|
-
%W{dicom
|
3
|
+
%W{dicom }.each do |lib| #####RMagick
|
4
4
|
require lib unless defined?(lib)
|
5
5
|
end
|
6
6
|
rescue LoadError => e
|
@@ -86,10 +86,12 @@ class RawImageDatasetThumbnail
|
|
86
86
|
default_name = @dataset.series_description.escape_filename
|
87
87
|
filepath ||= File.join(output_directory, default_name + '.png')
|
88
88
|
|
89
|
+
|
89
90
|
begin
|
90
91
|
case @processor
|
91
92
|
when :rubydicom
|
92
|
-
@path =
|
93
|
+
@path = create_thumbnail_with_rubydicom_dcmtk(filepath)
|
94
|
+
#@path = create_thumbnail_with_rubydicom(filepath)
|
93
95
|
when :slicer
|
94
96
|
@path = create_thumbnail_with_fsl_slicer(filepath)
|
95
97
|
end
|
@@ -108,6 +110,38 @@ class RawImageDatasetThumbnail
|
|
108
110
|
end
|
109
111
|
|
110
112
|
private
|
113
|
+
|
114
|
+
# Creates a thumbnail using RubyDicom and dcmtk
|
115
|
+
# Pass in an absolute or relative filepath, including filename and extension.
|
116
|
+
# Returns an absolute path to the created thumbnail image.
|
117
|
+
def create_thumbnail_with_rubydicom_dcmtk(output_file)
|
118
|
+
output_file = File.expand_path(output_file)
|
119
|
+
|
120
|
+
dicom_files = Dir.glob(File.join(dataset.directory, dataset.glob))
|
121
|
+
if dicom_files.empty? # Try the glob again with a zipped extension.
|
122
|
+
dicom_files = Dir.glob(File.join(dataset.directory, dataset.glob) + '*.bz2')
|
123
|
+
end
|
124
|
+
if dicom_files.empty? # If still empty...
|
125
|
+
raise StandardError, "Could not find dicom files using #{dataset.glob} in #{dataset.directory}"
|
126
|
+
end
|
127
|
+
dicom_file = Pathname(dicom_files[(dicom_files.size/2)+1])
|
128
|
+
dicom_file.local_copy do |lc|
|
129
|
+
dcm = DICOM::DObject.new(lc.to_s)
|
130
|
+
raise ScriptError, "Could not read dicom #{dicom_file.to_s}" unless dcm.read_success
|
131
|
+
v_call = "dcmj2pnm -v +Wi 1 --write-png "+lc.to_s+" "+output_file
|
132
|
+
v_results = %x[#{v_call}]
|
133
|
+
puts "results= "+v_results
|
134
|
+
puts "dicom_file= "+dicom_file.to_s
|
135
|
+
puts "output_file= "+output_file
|
136
|
+
#### image = dcm.get_image_magick(:rescale => true)
|
137
|
+
#### raise ScriptError, "RubyDicom did not return an image array (this is probably a color image)." unless image.kind_of? Magick::Image
|
138
|
+
#### image.write(output_file)
|
139
|
+
end
|
140
|
+
|
141
|
+
raise(ScriptError, "Error creating thumbnail #{output_file}") unless File.exist?(output_file)
|
142
|
+
|
143
|
+
return output_file
|
144
|
+
end
|
111
145
|
|
112
146
|
# Creates a thumbnail using RubyDicom
|
113
147
|
# Pass in an absolute or relative filepath, including filename and extension.
|
data/lib/metamri/version.rb
CHANGED
data/lib/metamri.rb
CHANGED
data/metamri.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_runtime_dependency('dicom', "~> 0.8.0")
|
21
21
|
s.add_runtime_dependency('activeresource', "~> 3.0")
|
22
|
-
s.add_runtime_dependency('rmagick', "~> 2.13.1")
|
22
|
+
##### s.add_runtime_dependency('rmagick', "~> 2.13.1")
|
23
23
|
s.add_runtime_dependency('hirb', "~> 0.4")
|
24
24
|
s.add_runtime_dependency('sqlite3', "~>1.3.4")
|
25
25
|
s.add_development_dependency('rspec', "~> 2.5")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metamri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 16
|
10
|
+
version: 0.2.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kristopher J. Kosmatka
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-03-25 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: dicom
|
@@ -49,26 +49,10 @@ dependencies:
|
|
49
49
|
version: "3.0"
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rmagick
|
54
|
-
prerelease: false
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 57
|
61
|
-
segments:
|
62
|
-
- 2
|
63
|
-
- 13
|
64
|
-
- 1
|
65
|
-
version: 2.13.1
|
66
|
-
type: :runtime
|
67
|
-
version_requirements: *id003
|
68
52
|
- !ruby/object:Gem::Dependency
|
69
53
|
name: hirb
|
70
54
|
prerelease: false
|
71
|
-
requirement: &
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
72
56
|
none: false
|
73
57
|
requirements:
|
74
58
|
- - ~>
|
@@ -79,11 +63,11 @@ dependencies:
|
|
79
63
|
- 4
|
80
64
|
version: "0.4"
|
81
65
|
type: :runtime
|
82
|
-
version_requirements: *
|
66
|
+
version_requirements: *id003
|
83
67
|
- !ruby/object:Gem::Dependency
|
84
68
|
name: sqlite3
|
85
69
|
prerelease: false
|
86
|
-
requirement: &
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
87
71
|
none: false
|
88
72
|
requirements:
|
89
73
|
- - ~>
|
@@ -95,11 +79,11 @@ dependencies:
|
|
95
79
|
- 4
|
96
80
|
version: 1.3.4
|
97
81
|
type: :runtime
|
98
|
-
version_requirements: *
|
82
|
+
version_requirements: *id004
|
99
83
|
- !ruby/object:Gem::Dependency
|
100
84
|
name: rspec
|
101
85
|
prerelease: false
|
102
|
-
requirement: &
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
103
87
|
none: false
|
104
88
|
requirements:
|
105
89
|
- - ~>
|
@@ -110,11 +94,11 @@ dependencies:
|
|
110
94
|
- 5
|
111
95
|
version: "2.5"
|
112
96
|
type: :development
|
113
|
-
version_requirements: *
|
97
|
+
version_requirements: *id005
|
114
98
|
- !ruby/object:Gem::Dependency
|
115
99
|
name: escoffier
|
116
100
|
prerelease: false
|
117
|
-
requirement: &
|
101
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
118
102
|
none: false
|
119
103
|
requirements:
|
120
104
|
- - ">="
|
@@ -124,7 +108,7 @@ dependencies:
|
|
124
108
|
- 0
|
125
109
|
version: "0"
|
126
110
|
type: :development
|
127
|
-
version_requirements: *
|
111
|
+
version_requirements: *id006
|
128
112
|
description: Extraction of MRI metadata.
|
129
113
|
email: ekk@medicine.wisc.edu
|
130
114
|
executables:
|