Class: RTKIT::Series

Inherits:
Object
  • Object
show all
Defined in:
lib/rtkit/series.rb

Overview

Contains the DICOM data and methods related to a series.

Relations

  • A Series belongs to a Study.

  • Some types of Series (e.g. CT, MR) have many Image instances.

Direct Known Subclasses

DoseVolume, ImageSeries, Plan, RTDose, RTImage, StructureSet

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(series_uid, modality, study, options = {}) ⇒ Series

Creates a new Series instance. The Series Instance UID string is used to uniquely identify a Series.

Parameters

  • series_uid – The Series Instance UID string.

  • modality – The Modality string of the Series, e.g. ‘CT’ or ‘RTSTRUCT’.

  • study – The Study instance that this Series belongs to.

  • options – A hash of parameters.

Options

  • :class_uid – String. The SOP Class UID (DICOM tag ‘0008,0016’).

  • :date – String. The Series Date (DICOM tag ‘0008,0021’).

  • :time – String. The Series Time (DICOM tag ‘0008,0031’).

  • :description – String. The Series Description (DICOM tag ‘0008,103E’).

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rtkit/series.rb', line 43

def initialize(series_uid, modality, study, options={})
  raise ArgumentError, "Invalid argument 'uid'. Expected String, got #{series_uid.class}." unless series_uid.is_a?(String)
  raise ArgumentError, "Invalid argument 'modality'. Expected String, got #{modality.class}." unless modality.is_a?(String)
  raise ArgumentError, "Invalid argument 'study'. Expected Study, got #{study.class}." unless study.is_a?(Study)
  # Key attributes:
  @series_uid = series_uid
  @modality = modality
  @study = study
  # Optional attributes:
  @class_uid = options[:class_uid]
  @date = options[:date]
  @time = options[:time]
  @description = options[:description]
end

Instance Attribute Details

#class_uidObject (readonly)

The SOP Class UID.



13
14
15
# File 'lib/rtkit/series.rb', line 13

def class_uid
  @class_uid
end

#dateObject (readonly)

The Series Date.



15
16
17
# File 'lib/rtkit/series.rb', line 15

def date
  @date
end

#descriptionObject (readonly)

The Series Description.



17
18
19
# File 'lib/rtkit/series.rb', line 17

def description
  @description
end

#modalityObject (readonly)

The Modality of the Series.



19
20
21
# File 'lib/rtkit/series.rb', line 19

def modality
  @modality
end

#series_uidObject (readonly)

The Series Instance UID.



23
24
25
# File 'lib/rtkit/series.rb', line 23

def series_uid
  @series_uid
end

#studyObject (readonly)

The Series’s Study reference.



21
22
23
# File 'lib/rtkit/series.rb', line 21

def study
  @study
end

#timeObject (readonly)

The Series Time.



25
26
27
# File 'lib/rtkit/series.rb', line 25

def time
  @time
end

Instance Method Details

#image_modality?Boolean

Returns true if the series is of a modality which means it contains multiple images (CT, MR, RTImage, RTDose). Returns false if not.

Returns:

  • (Boolean)


61
62
63
64
65
66
67
# File 'lib/rtkit/series.rb', line 61

def image_modality?
  if IMAGE_MODALITIES.include?(@modality)
    return true
  else
    return false
  end
end

#uidObject

Returns the unique identifier string, which for an ImageSeries is the Series Instance UID, and for the other types of Series (e.g. StructureSet, Plan, etc) it is the SOP Instance UID.



72
73
74
# File 'lib/rtkit/series.rb', line 72

def uid
  return @sop_uid || @series_uid
end