Module: DCMTK::Configuration

Included in:
DCMTK
Defined in:
lib/dcmtk/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cliString?

Force a specific CLI command for conversion. When nil (default), auto-detects: dcm2img if available, otherwise dcmj2pnm.

Returns:

  • (String, nil)


45
46
47
# File 'lib/dcmtk/configuration.rb', line 45

def cli
  @cli
end

#loggerLogger

Logger for debug output, default is ‘Logger.new(STDOUT)`, but you can override it, for example if you want the logs to be written to a file.

Returns:

  • (Logger)


20
21
22
# File 'lib/dcmtk/configuration.rb', line 20

def logger
  @logger
end

#shell_apiString

Instructs DCMTK how to execute the shell commands. Available APIs are “open3” (default) and “posix-spawn” (requires the “posix-spawn” gem).

Returns:

  • (String)


37
38
39
# File 'lib/dcmtk/configuration.rb', line 37

def shell_api
  @shell_api
end

#timeoutInteger

If you don’t want commands to take too long, you can set a timeout (in seconds).

Returns:

  • (Integer)


12
13
14
# File 'lib/dcmtk/configuration.rb', line 12

def timeout
  @timeout
end

#whinyBoolean

If set to true, it will raise errors on non-zero exit codes. Defaults to true.

Returns:

  • (Boolean)


28
29
30
# File 'lib/dcmtk/configuration.rb', line 28

def whiny
  @whiny
end

Class Method Details

.extended(base) ⇒ Object



47
48
49
50
51
# File 'lib/dcmtk/configuration.rb', line 47

def self.extended(base)
  base.whiny = true
  base.shell_api = "open3"
  base.logger = Logger.new($stdout).tap { |l| l.level = Logger::INFO }
end

Instance Method Details

#configure {|self| ... } ⇒ Object

Examples:

DCMTK.configure do |config|
  config.timeout = 5
end

Yields:

  • (self)


60
61
62
# File 'lib/dcmtk/configuration.rb', line 60

def configure
  yield self
end