lib/metamri/raw_image_file.rb in metamri-0.2.9 vs lib/metamri/raw_image_file.rb in metamri-0.2.10
- old
+ new
@@ -39,11 +39,11 @@
# The scanner used to perform this scan, e.g. 'Andys3T'.
attr_reader :source
# An identifier unique to a 'visit', these are assigned by the scanner techs at scan time.
attr_reader :rmr_number
# An identifier unique to a Study Session - AKA Exam Number
- attr_reader :study_id
+ attr_reader :exam_number
# A short string describing the acquisition sequence. These come from the scanner.
# code and are used to initialise SeriesDescription objects to find related attributes.
attr_reader :series_description
# A short string describing the study sequence. These come from the scanner.
attr_reader :study_description
@@ -71,10 +71,12 @@
attr_reader :warnings
# Serialized RubyDicomHeader Object (for DICOMs only)
attr_reader :dicom_header
# Hash of all DICOM Tags including their Names and Values (See #dicom_taghash for more information on the structure)
attr_reader :dicom_taghash
+ # DICOM SOP Instance UID (from the scanned file)
+ attr_reader :dicom_image_uid
# DICOM Series UID
attr_reader :dicom_series_uid
# DICOM Study UID
attr_reader :dicom_study_uid
# Scan Tech Initials
@@ -233,13 +235,21 @@
db_row = db.execute( db_fetch )
db.close
return db_row
end
+ # The series ID (dicom_series_uid [dicom] or series_uid [pfile/ifile])
+ # This is unique for DICOM datasets, but not for PFiles
+ def series_uid
+ @dicom_series_uid || @series_uid
+ end
+
+ # The UID unique to the raw image file scanned
+ def image_uid
+ @dicom_image_uid || @image_uid
+ end
-
-
private
def from_table_where
@@ -323,10 +333,11 @@
# Here are some example DICOM Tags and Values
# 0008,0022 Acquisition Date DA 8 20101103
# 0008,0030 Study Time TM 6 101538
# 0008,0080 Institution Name LO 4 Institution
# 0008,1010 Station Name SH 8 Station
+ # 0008,0018 SOP Instance UID 12 1.2.840.113619.2.155.3596.6906438.17031.1121881958.942
# 0008,1030 Study Description LO 12 PILOT Study
# 0008,103E Series Description LO 12 3pl loc FGRE
# 0008,1070 Operators' Name PN 2 SP
# 0008,1090 Manufacturer's Model Name LO 16 DISCOVERY MR750
# 0010,0010 Patient's Name PN 12 mosPilot
@@ -384,13 +395,14 @@
:field_strength => "0018,0087",
:slice_spacing => "0018,0088",
:software_version => "0018,1020",
:protocol_name => "0018,1030",
:bold_reps => "0020,0105",
- :dicom_series_uid => "0020,000E",
+ :dicom_image_uid => "0008,0018", # Each DICOM Image (i.e. raw image file) has a unique SOP Instance UID
+ :dicom_series_uid => "0020,000E", # Series UID (shared by all dicoms in the same series)
:dicom_study_uid => "0020,000D",
- :study_id => "0020,0010",
+ :exam_number => "0020,0010",
:num_slices => "0020,1002",
:acquisition_matrix_x => "0028,0010",
:acquisition_matrix_y => "0028,0011"
}
@@ -459,11 +471,11 @@
dicom_tag_templates[:rmr_number] = {
:type => :string,
:pat => /[ID Accession Number|ID Study Description]\/\/(RMR.*)\n/i,
:required => true
}
- dicom_tag_templates[:study_id] = {
+ dicom_tag_templates[:exam_number] = {
:type => :string,
:pat => /STUDY ID\/\/([0-9]+)/i,
:required => true
}
dicom_tag_templates[:slice_thickness] = {
@@ -578,10 +590,11 @@
rmr_number_pat = /Patient ID for this exam: ([[:graph:]]+)/i
bold_reps_pat = /Number of excitations: ([0-9]+)/i
rep_time_pat = /Pulse repetition time \(usec\): ([0-9]+)/i
study_uid_pat = /Study entity unique ID: ([[:graph:]]+)/i
series_uid_pat = /Series entity unique ID: ([[:graph:]]+)/i
+ image_uid_pat = /Image unique ID: ([[:graph:]]+)/i
rmr_number_pat =~ @hdr_data
@rmr_number = ($1).nil? ? "rmr not found" : ($1).strip.chomp
source_pat =~ @hdr_data
@@ -618,12 +631,16 @@
rep_time_pat =~ @hdr_data
@rep_time = ($1).to_f / 1000000
study_uid_pat =~ @hdr_data
- @dicom_study_uid = ($1).strip.chomp unless $1.nil?
+ @study_uid = ($1).strip.chomp unless $1.nil?
series_uid_pat =~ @hdr_data
- @dicom_series_uid = ($1).strip.chomp
+ @series_uid = ($1).strip.chomp unless $1.nil?
+
+ image_uid_pat =~ @hdr_data
+ @image_uid = ($1).strip.chomp unless $1.nil?
+
end
end
\ No newline at end of file