metamri 0.1.21 → 0.1.22

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/list_visit +23 -3
  3. data/metamri.gemspec +4 -4
  4. metadata +4 -15
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.21
1
+ 0.1.22
data/bin/list_visit CHANGED
@@ -51,7 +51,14 @@ end
51
51
  def list_visit(raw_directory, options = {})
52
52
  unless $LOG
53
53
  $LOG = Logger.new(STDOUT)
54
- $LOG.level = options[:verbose] ? Logger::DEBUG : Logger::INFO
54
+ case options[:verbose]
55
+ when true
56
+ $LOG.level = Logger::DEBUG
57
+ when nil
58
+ $LOG.level = Logger::INFO
59
+ when false
60
+ $LOG.level = Logger::WARN
61
+ end
55
62
  end
56
63
 
57
64
  # First try to lookup Visit and Datasets through active_resource
@@ -65,7 +72,7 @@ def list_visit(raw_directory, options = {})
65
72
  raise IOError.new("Could not lookup visit using path.") unless visit
66
73
  raise IOError.new("Returned visit does not match path.") unless visit.path == raw_directory
67
74
  rescue ScriptError, IOError => e
68
- puts e
75
+ puts e unless options[:verbose] == false
69
76
  visit = VisitRawDataDirectory.new(raw_directory)
70
77
  begin
71
78
  visit.scan(options)
@@ -78,7 +85,15 @@ def list_visit(raw_directory, options = {})
78
85
  # Output a pretty version of the visit details.
79
86
  # Visit is Either a RawVisitDataDirectory or a RawVisitDataDirectoryResource,
80
87
  # and either should respond to to_s
81
- visit.to_s
88
+ #
89
+ # Either output the entire visit (or if a search is requested) just the
90
+ # datasets that match the search.
91
+ unless options[:grep]
92
+ visit.to_s
93
+ else
94
+ datasets = visit.datasets.select{ |ds| ds.series_description =~ /#{options[:grep]}/i }
95
+ puts datasets.collect {|ds| ds.methods.include?('directory') ? ds.directory : ds.path }
96
+ end
82
97
 
83
98
  end
84
99
 
@@ -95,6 +110,11 @@ def parse_options
95
110
  options[:verbose] = true
96
111
  end
97
112
 
113
+ opts.on('-g', '--grep GREP', "Search series descriptions") do |grep|
114
+ options[:grep] = grep
115
+ options[:verbose] = false
116
+ end
117
+
98
118
  opts.on_tail('-h', '--help', "Show this message") { puts(parser); exit }
99
119
  opts.on_tail("If no directory is given, default is the current directory.")
100
120
  opts.on_tail("Example: #{File.basename(__FILE__)} pd006")
data/metamri.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{metamri}
8
- s.version = "0.1.21"
8
+ s.version = "0.1.22"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristopher J. Kosmatka"]
12
- s.date = %q{2010-07-15}
12
+ s.date = %q{2010-10-05}
13
13
  s.description = %q{Extraction of MRI metadata and insertion into compatible sqlite3 databases.}
14
14
  s.email = %q{kk4@medicine.wisc.edu}
15
15
  s.executables = ["import_study.rb", "import_visit.rb", "import_respiratory_files.rb", "list_visit", "convert_visit.rb"]
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.homepage = %q{http://github.com/brainmap/metamri}
51
51
  s.rdoc_options = ["--charset=UTF-8"]
52
52
  s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.7}
53
+ s.rubygems_version = %q{1.3.6}
54
54
  s.summary = %q{MRI metadata}
55
55
  s.test_files = [
56
56
  "test/nifti_builder_spec.rb",
@@ -65,7 +65,7 @@ Gem::Specification.new do |s|
65
65
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
66
  s.specification_version = 3
67
67
 
68
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
69
  s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 0"])
70
70
  s.add_runtime_dependency(%q<dicom>, [">= 0"])
71
71
  s.add_development_dependency(%q<rspec>, [">= 0"])
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metamri
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 21
10
- version: 0.1.21
8
+ - 22
9
+ version: 0.1.22
11
10
  platform: ruby
12
11
  authors:
13
12
  - Kristopher J. Kosmatka
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-07-15 00:00:00 -05:00
17
+ date: 2010-10-05 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: sqlite3-ruby
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 3
30
27
  segments:
31
28
  - 0
32
29
  version: "0"
@@ -36,11 +33,9 @@ dependencies:
36
33
  name: dicom
37
34
  prerelease: false
38
35
  requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
37
  - - ">="
42
38
  - !ruby/object:Gem::Version
43
- hash: 3
44
39
  segments:
45
40
  - 0
46
41
  version: "0"
@@ -50,11 +45,9 @@ dependencies:
50
45
  name: rspec
51
46
  prerelease: false
52
47
  requirement: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
48
  requirements:
55
49
  - - ">="
56
50
  - !ruby/object:Gem::Version
57
- hash: 3
58
51
  segments:
59
52
  - 0
60
53
  version: "0"
@@ -112,27 +105,23 @@ rdoc_options:
112
105
  require_paths:
113
106
  - lib
114
107
  required_ruby_version: !ruby/object:Gem::Requirement
115
- none: false
116
108
  requirements:
117
109
  - - ">="
118
110
  - !ruby/object:Gem::Version
119
- hash: 3
120
111
  segments:
121
112
  - 0
122
113
  version: "0"
123
114
  required_rubygems_version: !ruby/object:Gem::Requirement
124
- none: false
125
115
  requirements:
126
116
  - - ">="
127
117
  - !ruby/object:Gem::Version
128
- hash: 3
129
118
  segments:
130
119
  - 0
131
120
  version: "0"
132
121
  requirements: []
133
122
 
134
123
  rubyforge_project:
135
- rubygems_version: 1.3.7
124
+ rubygems_version: 1.3.6
136
125
  signing_key:
137
126
  specification_version: 3
138
127
  summary: MRI metadata