brainmap-ImageData 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
+
6
+ require 'test/unit'
7
+ require 'visit'
8
+ require 'pathname'
9
+
10
+
11
+ class RawImageFileTest < Test::Unit::TestCase
12
+ DBFILE = '/Data/home/kris/TextMateProjects/TransferScans/db/development.sqlite3'
13
+
14
+ def setup
15
+ # DO NOTHING
16
+ end
17
+
18
+ def test_scan_and_insert
19
+ @v = Visit.new( '/Data/vtrak1/raw/alz_2000/alz093', 'ALZ' )
20
+ @v.scan
21
+ @v.init_db(DBFILE)
22
+ @v.db_insert!
23
+ end
24
+ end
@@ -0,0 +1,77 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
+
6
+ require 'test/unit'
7
+ require 'visit_raw_data_directory'
8
+ require 'pathname'
9
+ require 'logger'
10
+
11
+ class RawImageFileTest < Test::Unit::TestCase
12
+ DBFILE = '/Users/kris/projects/TransferScans/db/development.sqlite3'
13
+ LOG = Logger.new('visit_test.log', shift_age = 7, shift_size = 1048576)
14
+ STUDIES = [
15
+ # Pathname.new('/Data/vtrak1/raw/alz_2000'),
16
+ # Pathname.new('/Data/vtrak1/raw/alz_2000'),
17
+ # Pathname.new('/Data/vtrak1/raw/pib_pilot_mri'),
18
+ # Pathname.new('/Data/vtrak1/raw/johnson.tbi-va.visit1'),
19
+ # Pathname.new('/Data/vtrak1/raw/wrap140'),
20
+ Pathname.new('/Data/vtrak1/raw/cms/uwmr'),
21
+ Pathname.new('/Data/vtrak1/raw/cms/wais'),
22
+ Pathname.new('/Data/vtrak1/raw/esprit/9month'),
23
+ Pathname.new('/Data/vtrak1/raw/esprit/baseline')
24
+ # Pathname.new('/Data/vtrak1/raw/gallagher_pd'),
25
+ # Pathname.new('/Data/vtrak1/raw/pc_4000'),
26
+ # Pathname.new('/Data/vtrak1/raw/ries.aware.visit1'),
27
+ # Pathname.new('/Data/vtrak1/raw/tbi_1000'),
28
+ # Pathname.new('/Data/vtrak1/raw/tbi_aware')
29
+ ]
30
+ FILTERS = [
31
+ # /^alz...$/,
32
+ # /^alz..._[2AB]$/,
33
+ # /^3..._/,
34
+ # /^tbi/,
35
+ # /^25/,
36
+ /^cms_...$/,
37
+ /^pc...$/,
38
+ /^3.._/,
39
+ /^3.._/
40
+ # /^pd..._/,
41
+ # /^pc...$/,
42
+ # /^awr.*\d$/,
43
+ # /^tbi...$|^tbi..._2$/,
44
+ # /^tbi..._3$/
45
+ ]
46
+ PROTOCOLS = ['ALZ_visit1','ALZ_visit2','PIB_PILOT','TBI_VA','WRAP140','CMS_UWMR','CMS_WAIS','ESPRIT_9month',
47
+ 'ESPRIT_baseline','gallagher_pd','pc_4000','ries.aware.visit1','tbi_1000','tbi_aware']
48
+
49
+ def setup
50
+ # DO NOTHING
51
+ end
52
+
53
+ def test_scan_and_insert
54
+ STUDIES.each_with_index do |study, i|
55
+ filter = FILTERS[i]
56
+ protocol = PROTOCOLS[i]
57
+ study.entries.each do |visit|
58
+ next if visit.to_s =~ /^\./
59
+ next unless visit.to_s =~ filter
60
+ visitdir = study + visit
61
+ v = VisitRawDataDirectory.new( visitdir.to_s )
62
+ begin
63
+ v.scan
64
+ v.db_insert!(DBFILE)
65
+ rescue Exception => e
66
+ puts "There was a problem scanning a dataset in #{visitdir}... skipping."
67
+ puts "Exception message: #{e.message}"
68
+ LOG.error "There was a problem scanning a dataset in #{visitdir}... skipping."
69
+ LOG.error "Exception message: #{e.message}"
70
+ ensure
71
+ v = nil
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brainmap-ImageData
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kristopher J. Kosmatka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-06 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Extraction of MRI metadata and insertion into compatible sqlite3 databases.
17
+ email: kk4@medicine.wisc.edu
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/CLUs/import_study.rb
24
+ - lib/CLUs/import_visit.rb
25
+ - lib/mysql_tools.rb
26
+ - lib/raw_image_dataset.rb
27
+ - lib/raw_image_file.rb
28
+ - lib/series_description.rb
29
+ - lib/visit_raw_data_directory.rb
30
+ - LICENSE
31
+ - README.rdoc
32
+ files:
33
+ - lib/CLUs/import_study.rb
34
+ - lib/CLUs/import_visit.rb
35
+ - lib/mysql_tools.rb
36
+ - lib/raw_image_dataset.rb
37
+ - lib/raw_image_file.rb
38
+ - lib/series_description.rb
39
+ - lib/visit_raw_data_directory.rb
40
+ - LICENSE
41
+ - Manifest
42
+ - Rakefile
43
+ - README.rdoc
44
+ - test/raw_image_dataset_test.rb
45
+ - test/raw_image_file_test.rb
46
+ - test/visit_duplication_test.rb
47
+ - test/visit_test.rb
48
+ - ImageData.gemspec
49
+ has_rdoc: true
50
+ homepage: http://github.com/brainmap/ImageData
51
+ licenses:
52
+ post_install_message:
53
+ rdoc_options:
54
+ - --line-numbers
55
+ - --inline-source
56
+ - --title
57
+ - ImageData
58
+ - --main
59
+ - README.rdoc
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "1.2"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project: imagedata
77
+ rubygems_version: 1.3.5
78
+ signing_key:
79
+ specification_version: 2
80
+ summary: Extraction of MRI metadata and insertion into compatible sqlite3 databases.
81
+ test_files:
82
+ - test/raw_image_dataset_test.rb
83
+ - test/raw_image_file_test.rb
84
+ - test/visit_duplication_test.rb
85
+ - test/visit_test.rb