metamri 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/raw_image_dataset.rb +1 -1
- data/lib/raw_image_file.rb +2 -2
- data/lib/visit_raw_data_directory.rb +1 -1
- data/metamri.gemspec +3 -3
- data/test/nifti_builder_spec.rb +15 -4
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/lib/raw_image_dataset.rb
CHANGED
@@ -146,7 +146,7 @@ Returns a path to the created dataset as a string if successful.
|
|
146
146
|
system "#{nifti_conversion_command}"
|
147
147
|
raise(IOError, "Could not convert image dataset: #{@directory} to #{nifti_output_file}") unless $? == 0
|
148
148
|
rescue IOError => e
|
149
|
-
|
149
|
+
$LOG.warn "-- Warning: #{e.message}"
|
150
150
|
end
|
151
151
|
return nifti_conversion_command, nifti_output_file
|
152
152
|
end
|
data/lib/raw_image_file.rb
CHANGED
@@ -249,14 +249,14 @@ used to read it.
|
|
249
249
|
Note: The rdgehdr is a binary file; the correct version for your architecture must be installed in the path.
|
250
250
|
=end
|
251
251
|
def read_header(absfilepath)
|
252
|
-
header = `#{DICOM_HDR} #{absfilepath} 2> /dev/null`
|
252
|
+
header = `#{DICOM_HDR} '#{absfilepath}' 2> /dev/null`
|
253
253
|
#header = `#{DICOM_HDR} #{absfilepath}`
|
254
254
|
if ( header.index("ERROR") == nil and
|
255
255
|
header.chomp != "" and
|
256
256
|
header.length > MIN_HDR_LENGTH )
|
257
257
|
return [ header, DICOM_HDR ]
|
258
258
|
end
|
259
|
-
header = `#{RDGEHDR} #{absfilepath} 2> /dev/null`
|
259
|
+
header = `#{RDGEHDR} '#{absfilepath}' 2> /dev/null`
|
260
260
|
#header = `#{RDGEHDR} #{absfilepath}`
|
261
261
|
if ( header.chomp != "" and
|
262
262
|
header.length > MIN_HDR_LENGTH )
|
@@ -472,7 +472,7 @@ class Pathname
|
|
472
472
|
tfbase = self.to_s =~ /\.bz2$/ ? self.basename.to_s.chomp(".bz2") : self.basename.to_s
|
473
473
|
tmpfile = File.join(tempdir, tfbase)
|
474
474
|
if self.to_s =~ /\.bz2$/
|
475
|
-
`bunzip2 -k -c #{self.to_s} >> #{tmpfile}`
|
475
|
+
`bunzip2 -k -c '#{self.to_s}' >> '#{tmpfile}'`
|
476
476
|
else
|
477
477
|
FileUtils.cp(self.to_s, tmpfile)
|
478
478
|
end
|
data/metamri.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{metamri}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
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-01-
|
12
|
+
s.date = %q{2010-01-22}
|
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
|
-
s.executables = ["
|
15
|
+
s.executables = ["convert_visit.rb", "import_study.rb", "import_visit.rb", "import_respiratory_files.rb"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"README.rdoc"
|
18
18
|
]
|
data/test/nifti_builder_spec.rb
CHANGED
@@ -2,17 +2,28 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'spec'
|
5
|
+
require 'fileutils'
|
5
6
|
require 'visit_raw_data_directory'
|
6
7
|
require 'raw_image_dataset'
|
7
8
|
require 'raw_image_file'
|
8
9
|
|
9
|
-
|
10
|
+
VISIT_FIXTURE = File.join(Dir.tmpdir, 'fixtures/visit_raw_data_directory/tbiva018b_9336_12022009')
|
11
|
+
VISIT_FIXTURE_SRC = '/Data/vtrak1/raw/johnson.tbi-va.visit1/tbiva018b_9336_12022009'
|
12
|
+
|
13
|
+
describe "Convert Unknown Dicoms to Nifti Files" do
|
14
|
+
before(:all) do
|
15
|
+
# Initialize a local scratch directory to hold fixtures for testing if it doesn't already exist.
|
16
|
+
unless File.directory?(VISIT_FIXTURE)
|
17
|
+
FileUtils.mkdir_p(File.dirname(VISIT_FIXTURE))
|
18
|
+
FileUtils.cp_r(VISIT_FIXTURE_SRC, VISIT_FIXTURE)
|
19
|
+
end
|
20
|
+
end
|
10
21
|
|
11
22
|
before(:each) do
|
12
|
-
@visit = VisitRawDataDirectory.new(
|
23
|
+
@visit = VisitRawDataDirectory.new(VISIT_FIXTURE, 'johnson.tbi-va.visit1')
|
13
24
|
@dataset = RawImageDataset.new(
|
14
|
-
File.join(
|
15
|
-
[RawImageFile.new(File.join(
|
25
|
+
File.join(VISIT_FIXTURE, '001'),
|
26
|
+
[RawImageFile.new(File.join(VISIT_FIXTURE, '001/I0001.dcm'))]
|
16
27
|
)
|
17
28
|
@test_niftis = Array.new
|
18
29
|
@output_directories = Array.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metamri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristopher J. Kosmatka
|
@@ -9,16 +9,16 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-22 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Extraction of MRI metadata and insertion into compatible sqlite3 databases.
|
17
17
|
email: kk4@medicine.wisc.edu
|
18
18
|
executables:
|
19
|
+
- convert_visit.rb
|
19
20
|
- import_study.rb
|
20
21
|
- import_visit.rb
|
21
|
-
- convert_visit.rb
|
22
22
|
- import_respiratory_files.rb
|
23
23
|
extensions: []
|
24
24
|
|