metamri 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGQ1ZTRjNjZkY2E3NmVkNDgyYmNhM2Y3MGYyZDcwNGQzOTc4Y2UxNA==
4
+ NGQyYjcxODY4OWZkOWY3YjE3ZWM0MWFjYzQ4Y2E5YWExOWQzMjZiNQ==
5
5
  data.tar.gz: !binary |-
6
- NWUxZDA4ZjQ1N2ExYTk0NjI3OGI1ZWMyZDk5ZTEyNGQxODg0MTM3MQ==
6
+ ZWI2ZWU1Y2YwNTNlODRmOWRlOGQ4YzUxNDQ4MzllZWY4NGM3NzFlOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjEyYmJkMjdjMDBlZjM1M2Y0OGM3NGEwNjQ1MTczMWViYzJlNTI1MzcwZTEw
10
- YTBjYTljMjE4ZmNlMWQ4YTAwNjFhMTc5ZDZjOThhN2JhMDZmODI5ZjhjOTYz
11
- NWVhZGY2NmM2MDRhYzE4NjY4MzMwMWQ4MDczYjFhZDNkNjNjZWE=
9
+ M2E4Njk0NmMzMDk3MTcwNWUxMTJjMDY2MGNmM2UwNDgxNDBlNjcxYTgwOWNi
10
+ YzQxYTFjZmYxNDM1OGMwNTFlNzJmODI4ZGFjODBmNzkyNWM5NThmZDM2MGI2
11
+ ZGJlNWNhNmM4NmY5ZTA3OWMxM2RmODc3MzU3ODAzMmNlNzc1NjI=
12
12
  data.tar.gz: !binary |-
13
- YTAwMWRiOTgzNDA2OTY5YTBjMDhlZjIxYWQzZDgwZmY3YTgxNGI0NzU2ZTEy
14
- MzRlY2RmZTRiYjNiZWU2OWYyYTFhNzM1YjEzZjJmNDMxZWE4YjQ4M2JjMWVi
15
- ZWQ5OTliNTY3OGY1NTQ0NzMxMDE4NmFmZmFjNTcyMGZlYzZkNTg=
13
+ MjY3YTcxOTEyNDgyN2UwZTk2YzI0ZjY5ZjY3NzAwYTkzZDBjNzlkZGMxODg4
14
+ OWY0MmNmN2IwZWU3MDlmZTk3YWFmMjRlOTE0OTE4ZDgzYTUwMzU1ZTgwZDIz
15
+ MTE5YjZiNzYyNzE2NTBhN2E0NmI3MzZlZjc5ZDk3NzBkMzk5YjY=
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'tmpdir'
2
3
 
3
4
  class String
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # Dicom Additions is a test extension of DICOM to allow for gathering common tags
2
3
  class DicomGroup
3
4
  # Array of DObjects to aggregate
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # An ImageQualityCheckResource is a ruby object that represents a quality check
2
3
  # pulled down from the DataPanda database. It contains notes on the quality of
3
4
  # specific images, with a note for each possible problem, and an overall note.
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'mysql'
2
3
 
3
4
  class Mysql
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # Builds Nifti files from Dicoms.
2
3
  module UnknownImageDataset
3
4
  # Always set AFNI GE DICOM Fix to "No" before conversion with to3d.
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'rubygems'
2
3
  # require 'sqlite3'
3
4
  require 'fileutils'
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  class RawImageDatasetResource < ActiveResource::Base
2
3
  self.site = VisitRawDataDirectory::DATAPANDA_SERVER
3
4
  self.element_name = "image_dataset"
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'tmpdir'
2
3
  begin
3
4
  %W{dicom }.each do |lib| #####RMagick
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'pp'
2
3
  require 'rubygems';
3
4
  require 'yaml';
@@ -31,7 +32,7 @@ class RawImageFile
31
32
 
32
33
  # The file name that the instance represents.
33
34
  attr_reader :filename
34
- # Which header reading utility reads this file, currently 'rdgehdr' or 'dicom_hdr'.
35
+ # Which header reading utility reads this file, currently 'rdgehdr'(old p-files&wimr) or 'dicom_hdr' or 'printraw'(new p-files->waisman).
35
36
  attr_reader :hdr_reader
36
37
  # File types are either 'dicom' or 'pfile'.
37
38
  attr_reader :file_type
@@ -271,14 +272,21 @@ private
271
272
  case File.basename(absfilepath)
272
273
  when /^P.{5}\.7$|^I\..{3}/
273
274
  # Try reading Pfiles or Genesis I-Files with GE's printraw
274
- @current_hdr_reader = PRINTRAW
275
- header = `#{PRINTRAW} '#{absfilepath}' 2> /dev/null`
276
- #header = `#{RDGEHDR} #{absfilepath}`
277
- if ( header.chomp != "" and
278
- header.length > MIN_HDR_LENGTH )
279
- @current_hdr_reader = nil
280
- return [ header, PRINTRAW ]
281
- end
275
+ # printraw works on the new waisman p-files
276
+ # rdgehdr works on wimr p-files, and old waisman p-files
277
+ @current_hdr_reader = PRINTRAW
278
+ puts "aaaaaaa absfilepath="+absfilepath
279
+ header = `#{PRINTRAW} '#{absfilepath}' 2> /dev/null`
280
+ #header = `#{RDGEHDR} #{absfilepath}`
281
+ #puts "bbbbb header="+header
282
+ header = header.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "").force_encoding('UTF-8')
283
+ if ( header.chomp != "" and
284
+ header.length > MIN_HDR_LENGTH )
285
+ @current_hdr_reader = nil
286
+ return [ header, PRINTRAW ]
287
+ end
288
+
289
+
282
290
  # Try reading Pfiles or Genesis I-Files with GE's rdgehdr -- rdgehdr newer version needs macos 10.8, adrcdev2 = 10.7.5 -
283
291
  # works on old headers, not on new header format
284
292
  ###@current_hdr_reader = RDGEHDR
@@ -349,7 +357,7 @@ private
349
357
  # 0008,1010 Station Name SH 8 Station
350
358
  # 0008,0018 SOP Instance UID 12 1.2.840.113619.2.155.3596.6906438.17031.1121881958.942
351
359
  # 0008,1030 Study Description LO 12 PILOT Study
352
- # 0008,103E Series Description LO 12 3pl loc FGRE
360
+ # 0008,103E Series Description LO 12 3pl loc FGR
353
361
  # 0008,1070 Operators' Name PN 2 SP
354
362
  # 0008,1090 Manufacturer's Model Name LO 16 DISCOVERY MR750
355
363
  # 0010,0010 Patient's Name PN 12 mosPilot
@@ -603,10 +611,25 @@ private
603
611
  series_uid_pat = /series_uid = ([[:graph:]]+)/i
604
612
  image_uid_pat = /image_uid = (.*)/i #([[:graph:]]+)/i
605
613
 
614
+ # @hdr_data = @hdr_data.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "").force_encoding('UTF-8')
615
+ #@hdr_data = @hdr_data.encode!('UTF-8', 'UTF-8', :invalid => :replace)
616
+ #@hdr_data_2 = @hdr_data.encode("UTF-8")
617
+ #@hdr_data.encode!("ISO-8859-1", :invalid => :replace).encode("UTF-8")
618
+ #@hdr_data.encode("UTF-8", :invalid => :replace, :replace => "") == invalid byte sequence in UTF-8
619
+ #@hdr_data.encode!("UTF-8", :invalid => :replace, :replace => "") invalid byte sequence in UTF-8
620
+ #@hdr_data.encode("ISO-8859-1", :invalid => :replace) invalid byte sequence in UTF-8
621
+ #@hdr_data = @hdr_data.encode('UTF-8','binary', :invalid => :replace,:undef => :replace, :replace =>'') #Attribute was supposed to be a Hash, but was a String
622
+ #@hdr_data = @hdr_data.encode('UTF-8','UTF-8', :invalid => :replace,:undef => :replace, :replace =>'') # invalid byte sequence in UTF-8
623
+ #@hdr_data.encode('UTF-8','UTF-8', :invalid => :replace,:undef => :replace, :replace =>'') # invalid byte sequence in UTF-8
624
+ hdr_data_bak = @hdr_data
625
+ @hdr_data.encode!("ISO-8859-1", :invalid => :replace).encode("UTF-8") #Attribute was supposed to be a Hash, but was a String
626
+
627
+ puts "aaaaaaaaaaa"
606
628
 
607
629
  rmr_number_pat =~ @hdr_data
608
630
  @rmr_number = ($1).nil? ? "rmr not found" : ($1).strip.chomp
609
-
631
+ puts "bbbbbbbb "
632
+
610
633
  source_pat =~ @hdr_data
611
634
  @source = ($1).nil? ? "source not found" : ($1).strip.chomp
612
635
 
@@ -634,7 +657,6 @@ private
634
657
  series_description_pat =~ @hdr_data
635
658
  @series_description = ($1).strip.chomp
636
659
 
637
-
638
660
  recon_diam_pat =~ @hdr_data
639
661
  @reconstruction_diameter = ($1).to_i
640
662
 
@@ -643,17 +665,18 @@ private
643
665
 
644
666
  rep_time_pat =~ @hdr_data
645
667
  @rep_time = ($1).to_f / 1000000
646
-
647
668
 
648
669
  study_uid_pat =~ @hdr_data
649
670
  @study_uid = ($1).strip.chomp unless $1.nil?
650
671
 
651
672
  series_uid_pat =~ @hdr_data
652
- @series_uid = ($1).strip.chomp unless $1.nil?
653
-
673
+ @series_uid = ($1).strip.chomp unless $1.nil?
654
674
  image_uid_pat =~ @hdr_data
655
675
  @image_uid = ($1).strip.chomp unless $1.nil?
656
676
 
677
+ puts "rrrrrr @image_uid ="+@image_uid .to_s
678
+ @hdr_data = nil
679
+
657
680
  end
658
681
 
659
682
  # Extracts a collection of metadata from @hdr_data retrieved using the rdgehdr
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  =begin rdoc
2
3
  Provides a mapping between series descriptions that are extracted from raw image
3
4
  headers and some associated attributes.
@@ -1,3 +1,3 @@
1
1
  module Metamri
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'rubygems'
2
3
  require 'pathname'
3
4
  require 'tempfile'
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  $:.unshift File.dirname(__FILE__)
2
3
  require 'raw_image_dataset_resource'
3
4
 
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.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristopher J. Kosmatka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-22 00:00:00.000000000 Z
12
+ date: 2013-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dicom
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.1.4
171
+ rubygems_version: 2.1.10
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: MRI metadata