Sha256: 84cc5c402a53f8f5ec628509329b6be1c5e1e00b56fbcf8f7a1f5d300e6c3efd

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

$:.unshift File.dirname(__FILE__)
require 'raw_image_dataset_resource'

class VisitRawDataDirectoryResource < ActiveResource::Base
  self.site = VisitRawDataDirectory::DATAPANDA_SERVER
  self.element_name = "visit"
  
  # Creates a Backwards Transfer to go from ActiveRecord to Metamri Classes
  #
  # ActiveResource will provide :attr methods for column names from the 
  # database, so check the current schema.rb file for those.
  def to_metamri_visit_raw_data_directory    
    @visit = VisitRawDataDirectory.new(path)
    @visit.timestamp = date
    @visit.rmr_number = rmr
    @visit.scanner_source = scanner_source
    @visit.database_id = id
    return @visit
  end
  
  def datasets
    @datasets ||= RawImageDatasetResource.find(:all, :from => "/visits/#{id}/image_datasets.xml" )
  end
  
  # Convert a Resource and its datasets to a VisitRawDataDirectory and 
  # RawImageDataset, respectively, then pretty print it using
  # VisitRawDataDirectory.to_s
  # def to_s
  #   metamri_visit = to_metamri_visit_raw_data_directory
  #   metamri_visit.datasets = datasets.collect { |ds| ds.to_metamri_raw_image_dataset}
  #   metamri_visit.to_s
  # end
  
  def to_s
    puts; path.length.times { print "-" }; puts
    puts "#{path}"
    puts "#{rmr} - #{date} - #{scanner_source}"
    puts
    # puts "#{@scan_procedure_name}"
    puts RawImageDatasetResource.to_table(datasets)
    puts "Notes: " + notes unless notes.nil? or notes.empty?
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metamri-0.2.0 lib/metamri/visit_raw_data_directory_resource.rb
metamri-0.1.23 lib/metamri/visit_raw_data_directory_resource.rb
metamri-0.1.22 lib/metamri/visit_raw_data_directory_resource.rb
metamri-0.1.21 lib/metamri/visit_raw_data_directory_resource.rb
metamri-0.1.20 lib/metamri/visit_raw_data_directory_resource.rb
metamri-0.1.19 lib/metamri/visit_raw_data_directory_resource.rb