lib/metamri/raw_image_file.rb in metamri-0.2.5 vs lib/metamri/raw_image_file.rb in metamri-0.2.6
- old
+ new
@@ -105,16 +105,17 @@
end
# file type is based on file name but only if the header was read successfully
@file_type = determine_file_type
- # try to import attributes from the header, raise an ioerror if any attributes
- # are not found
+ # try to import attributes from the header, raise an ScriptError or NoMethodError
+ # if any required attributes are not found
begin
import_hdr
rescue ScriptError, NoMethodError => e
- raise IOError, "Could not find required DICOM Header Meta Element: #{e}"
+ # puts e.backtrace
+ raise e, "Could not find required DICOM Header Meta Element: #{e}"
rescue StandardError => e
raise e, "Header import failed for file #{@filename}. #{e}"
end
# deallocate the header data to save memory space.
@@ -617,10 +618,10 @@
rep_time_pat =~ @hdr_data
@rep_time = ($1).to_f / 1000000
study_uid_pat =~ @hdr_data
- @dicom_study_uid = ($1).strip.chomp
+ @dicom_study_uid = ($1).strip.chomp unless $1.nil?
series_uid_pat =~ @hdr_data
@dicom_series_uid = ($1).strip.chomp
end
\ No newline at end of file