Sha256: 6135bce8eceeb9ffe626b98996f5452b93e050274788f5fd43a4c33b5af6d05e

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

#!/usr/bin/env ruby
#
# == Synopsis 
#   A simple utility for listing visit details and scan acquistion
#   information from the terminal, either through freshly scanning
#   the filesystem or connecting to an imaging database and looking
#   up information through there (for Image Quality Checks, for 
#   example.
#
# == Examples
#
#   list_visit /Data/vtrak1/raw/ries.aware.visit1/awr001_7854_02102009
#
#   cd /Data/vtrak1/raw/ries.aware.visit1/awr001_7854_02102009
#   list_visit
#
#   If no raw data directory is given, the current directory will be assumed.
#     list_visit
#
# == Usage 
#   list_visit <raw_data_directory>
#
#   For help use: list_vist -h
#
# == Options
#   -h, --help          Displays help message
#
# == Author
#   Erik Kastman
#   WADRC Imaging Core
#

$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'metamri'
require 'pathname'
require 'rdoc/usage'
require 'logger'

def list_visit(raw_directory)
  $LOG = Logger.new(STDOUT)  
  $LOG.level = Logger::INFO
  visit = VisitRawDataDirectory.new(raw_directory)
  # visit = VisitRawDataDirectoryResource.find(:all, :from => '/visits/found.xml', :params => {:visit_search => {:rmr => 'rmr'}})

  begin
    visit.scan
    # visit.datasets = RawImageDatasetResource.find(:all, :from => "/visits/#{visit.database_id}/image_datasets.xml" )
  rescue IndexError => e
    $LOG.error "Are you sure #{raw_directory} is a valid raw visit directory?"
    raise e
  rescue Exception => e
    $LOG.error "There was a problem scanning a dataset in #{visit.visit_directory}... skipping."
    $LOG.error "Exception message: #{e.message}"
    raise e
  end
  
  visit.to_s

end

if File.basename(__FILE__) == File.basename($PROGRAM_NAME)
  RDoc::usage() if (ARGV[0] == '-h')

  # Default to scanning the current directory if no argument was given.
  raw_directory = ARGV[0] ||= File.expand_path('.')

  list_visit(raw_directory)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metamri-0.1.11 bin/list_visit