Sha256: b34d21048582e4af58ed02f7784d1d386ce04e5fa01b1a68c4b4c39a97d07bcf
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
#!/usr/bin/env ruby =begin rdoc Builds Nifti files from Dicoms. =end TO3D_CMD = 'to3d' module UnknownImageDataset # Always set AFNI GE DICOM Fix to "No" before conversion with to3d. ENV['AFNI_SLICE_SPACING_IS_GAP'] = "NO" def dataset_to_nifti(nifti_output_directory, nifti_filename, input_options = {} ) if input_options.has_key?(:dicom_files) input_files = input_options[:dicom_files].each {|file| file.to_s }.join(' ') elsif input_options.has_key?(:input_directory) input_files = "#{input_options[:input_directory]}/'#{glob}'" else input_files = "#{Dir.tmpdir}/'#{glob}'" end nifti_output_file = File.join(nifti_output_directory, nifti_filename) File.makedirs(nifti_output_directory) unless File.directory?(nifti_output_directory) raise(IOError, "Cannot write to #{nifti_output_directory}") unless File.writable?(nifti_output_directory) nifti_conversion_command = "#{TO3D_CMD} -session #{nifti_output_directory} -prefix #{nifti_filename} #{input_files}" return nifti_conversion_command, nifti_output_file end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
metamri-0.1.13 | lib/nifti_builder.rb |
metamri-0.1.11 | lib/nifti_builder.rb |
metamri-0.1.10 | lib/nifti_builder.rb |
metamri-0.1.9 | lib/nifti_builder.rb |
metamri-0.1.8 | lib/nifti_builder.rb |