Class: AsposeImagingCloud::DicomProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose-imaging-cloud/models/dicom_properties.rb

Overview

Represents information about image in dicom format.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DicomProperties

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 146

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'PlanarConfiguration')
    self.planar_configuration = attributes[:'PlanarConfiguration']
  end

  if attributes.has_key?(:'Reds')
    self.reds = attributes[:'Reds']
  end

  if attributes.has_key?(:'Greens')
    self.greens = attributes[:'Greens']
  end

  if attributes.has_key?(:'Blues')
    self.blues = attributes[:'Blues']
  end

  if attributes.has_key?(:'DicomHeaderInfoByBytes')
    self.dicom_header_info_by_bytes = attributes[:'DicomHeaderInfoByBytes']
  end

  if attributes.has_key?(:'SignedImage')
    self.signed_image = attributes[:'SignedImage']
  end

  if attributes.has_key?(:'DicomInfo')
    if (value = attributes[:'DicomInfo']).is_a?(Array)
      self.dicom_info = value
    end
  end

  if attributes.has_key?(:'SamplesPerPixel')
    self.samples_per_pixel = attributes[:'SamplesPerPixel']
  end

  if attributes.has_key?(:'BitsAllocated')
    self.bits_allocated = attributes[:'BitsAllocated']
  end

  if attributes.has_key?(:'PhotoInterpretation')
    self.photo_interpretation = attributes[:'PhotoInterpretation']
  end

  if attributes.has_key?(:'Width')
    self.width = attributes[:'Width']
  end

  if attributes.has_key?(:'Height')
    self.height = attributes[:'Height']
  end

  if attributes.has_key?(:'WindowCentre')
    self.window_centre = attributes[:'WindowCentre']
  end

  if attributes.has_key?(:'WindowWidth')
    self.window_width = attributes[:'WindowWidth']
  end

  if attributes.has_key?(:'PixelRepresentation')
    self.pixel_representation = attributes[:'PixelRepresentation']
  end

  if attributes.has_key?(:'RescaleIntercept')
    self.rescale_intercept = attributes[:'RescaleIntercept']
  end

  if attributes.has_key?(:'RescaleSlope')
    self.rescale_slope = attributes[:'RescaleSlope']
  end

  if attributes.has_key?(:'NumberOfFrames')
    self.number_of_frames = attributes[:'NumberOfFrames']
  end

  if attributes.has_key?(:'IsLittleEndian')
    self.is_little_endian = attributes[:'IsLittleEndian']
  end

  if attributes.has_key?(:'Offset')
    self.offset = attributes[:'Offset']
  end
end

Instance Attribute Details

#bits_allocatedObject

Gets or sets allocated bits count.



57
58
59
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 57

def bits_allocated
  @bits_allocated
end

#bluesObject

Gets or sets the array of blue colors.



42
43
44
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 42

def blues
  @blues
end

#dicom_header_info_by_bytesObject

Gets or sets the header information by bytes.



45
46
47
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 45

def dicom_header_info_by_bytes
  @dicom_header_info_by_bytes
end

#dicom_infoObject

Gets or sets the header information of the DICOM file.



51
52
53
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 51

def dicom_info
  @dicom_info
end

#greensObject

Gets or sets the array of green colors.



39
40
41
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 39

def greens
  @greens
end

#heightObject

Gets or sets the height.



66
67
68
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 66

def height
  @height
end

#is_little_endianObject

Indicates if DICOM image has little endian byte order.



87
88
89
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 87

def is_little_endian
  @is_little_endian
end

#number_of_framesObject

Gets or sets the number of frames.



84
85
86
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 84

def number_of_frames
  @number_of_frames
end

#offsetObject

Gets or sets the offset.



90
91
92
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 90

def offset
  @offset
end

#photo_interpretationObject

Gets or sets the photo interpretation.



60
61
62
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 60

def photo_interpretation
  @photo_interpretation
end

#pixel_representationObject

Gets or sets data representation of the pixel samples.



75
76
77
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 75

def pixel_representation
  @pixel_representation
end

#planar_configurationObject

Gets or sets the planar configuration.



33
34
35
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 33

def planar_configuration
  @planar_configuration
end

#redsObject

Gets or sets the array of red colors.



36
37
38
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 36

def reds
  @reds
end

#rescale_interceptObject

Gets or sets a value of the rescale intercept.



78
79
80
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 78

def rescale_intercept
  @rescale_intercept
end

#rescale_slopeObject

Gets or sets a value of the rescale slope.



81
82
83
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 81

def rescale_slope
  @rescale_slope
end

#samples_per_pixelObject

Gets or sets samples per pixel count.



54
55
56
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 54

def samples_per_pixel
  @samples_per_pixel
end

#signed_imageObject

Gets or sets a value indicating whether it’s a signed image.



48
49
50
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 48

def signed_image
  @signed_image
end

#widthObject

Gets or sets the width.



63
64
65
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 63

def width
  @width
end

#window_centreObject

Gets or sets the window centre.



69
70
71
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 69

def window_centre
  @window_centre
end

#window_widthObject

Gets or sets the width of the window.



72
73
74
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 72

def window_width
  @window_width
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 93

def self.attribute_map
  {
    :'planar_configuration' => :'PlanarConfiguration',
    :'reds' => :'Reds',
    :'greens' => :'Greens',
    :'blues' => :'Blues',
    :'dicom_header_info_by_bytes' => :'DicomHeaderInfoByBytes',
    :'signed_image' => :'SignedImage',
    :'dicom_info' => :'DicomInfo',
    :'samples_per_pixel' => :'SamplesPerPixel',
    :'bits_allocated' => :'BitsAllocated',
    :'photo_interpretation' => :'PhotoInterpretation',
    :'width' => :'Width',
    :'height' => :'Height',
    :'window_centre' => :'WindowCentre',
    :'window_width' => :'WindowWidth',
    :'pixel_representation' => :'PixelRepresentation',
    :'rescale_intercept' => :'RescaleIntercept',
    :'rescale_slope' => :'RescaleSlope',
    :'number_of_frames' => :'NumberOfFrames',
    :'is_little_endian' => :'IsLittleEndian',
    :'offset' => :'Offset'
  }
end

.swagger_typesObject

Attribute type mapping.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 119

def self.swagger_types
  {
    :'planar_configuration' => :'Integer',
    :'reds' => :'String',
    :'greens' => :'String',
    :'blues' => :'String',
    :'dicom_header_info_by_bytes' => :'String',
    :'signed_image' => :'BOOLEAN',
    :'dicom_info' => :'Array<String>',
    :'samples_per_pixel' => :'Integer',
    :'bits_allocated' => :'Integer',
    :'photo_interpretation' => :'String',
    :'width' => :'Integer',
    :'height' => :'Integer',
    :'window_centre' => :'Float',
    :'window_width' => :'Float',
    :'pixel_representation' => :'Integer',
    :'rescale_intercept' => :'Float',
    :'rescale_slope' => :'Float',
    :'number_of_frames' => :'Integer',
    :'is_little_endian' => :'BOOLEAN',
    :'offset' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 380

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      planar_configuration == o.planar_configuration &&
      reds == o.reds &&
      greens == o.greens &&
      blues == o.blues &&
      dicom_header_info_by_bytes == o.dicom_header_info_by_bytes &&
      signed_image == o.signed_image &&
      dicom_info == o.dicom_info &&
      samples_per_pixel == o.samples_per_pixel &&
      bits_allocated == o.bits_allocated &&
      photo_interpretation == o.photo_interpretation &&
      width == o.width &&
      height == o.height &&
      window_centre == o.window_centre &&
      window_width == o.window_width &&
      pixel_representation == o.pixel_representation &&
      rescale_intercept == o.rescale_intercept &&
      rescale_slope == o.rescale_slope &&
      number_of_frames == o.number_of_frames &&
      is_little_endian == o.is_little_endian &&
      offset == o.offset
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 443

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = AsposeImagingCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 509

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 420

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    attribute_key = self.class.attribute_map[key]
    attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[attribute_key].is_a?(Array)
        self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[attribute_key].nil?
      self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


407
408
409
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 407

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



413
414
415
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 413

def hash
  [planar_configuration, reds, greens, blues, dicom_header_info_by_bytes, signed_image, dicom_info, samples_per_pixel, bits_allocated, photo_interpretation, width, height, window_centre, window_width, pixel_representation, rescale_intercept, rescale_slope, number_of_frames, is_little_endian, offset].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 237

def list_invalid_properties
  invalid_properties = Array.new
  if @planar_configuration.nil?
    invalid_properties.push('invalid value for "planar_configuration", planar_configuration cannot be nil.')
  end

  if !@reds.nil? && @reds !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
    invalid_properties.push('invalid value for "reds", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
  end

  if !@greens.nil? && @greens !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
    invalid_properties.push('invalid value for "greens", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
  end

  if !@blues.nil? && @blues !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
    invalid_properties.push('invalid value for "blues", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
  end

  if !@dicom_header_info_by_bytes.nil? && @dicom_header_info_by_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
    invalid_properties.push('invalid value for "dicom_header_info_by_bytes", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
  end

  if @signed_image.nil?
    invalid_properties.push('invalid value for "signed_image", signed_image cannot be nil.')
  end

  if @samples_per_pixel.nil?
    invalid_properties.push('invalid value for "samples_per_pixel", samples_per_pixel cannot be nil.')
  end

  if @bits_allocated.nil?
    invalid_properties.push('invalid value for "bits_allocated", bits_allocated cannot be nil.')
  end

  if @width.nil?
    invalid_properties.push('invalid value for "width", width cannot be nil.')
  end

  if @height.nil?
    invalid_properties.push('invalid value for "height", height cannot be nil.')
  end

  if @window_centre.nil?
    invalid_properties.push('invalid value for "window_centre", window_centre cannot be nil.')
  end

  if @window_width.nil?
    invalid_properties.push('invalid value for "window_width", window_width cannot be nil.')
  end

  if @pixel_representation.nil?
    invalid_properties.push('invalid value for "pixel_representation", pixel_representation cannot be nil.')
  end

  if @rescale_intercept.nil?
    invalid_properties.push('invalid value for "rescale_intercept", rescale_intercept cannot be nil.')
  end

  if @rescale_slope.nil?
    invalid_properties.push('invalid value for "rescale_slope", rescale_slope cannot be nil.')
  end

  if @number_of_frames.nil?
    invalid_properties.push('invalid value for "number_of_frames", number_of_frames cannot be nil.')
  end

  if @is_little_endian.nil?
    invalid_properties.push('invalid value for "is_little_endian", is_little_endian cannot be nil.')
  end

  if @offset.nil?
    invalid_properties.push('invalid value for "offset", offset cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



489
490
491
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 489

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



495
496
497
498
499
500
501
502
503
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 495

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



483
484
485
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 483

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/aspose-imaging-cloud/models/dicom_properties.rb', line 316

def valid?
  return false if @planar_configuration.nil?
  return false if !@reds.nil? && @reds !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  return false if !@greens.nil? && @greens !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  return false if !@blues.nil? && @blues !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  return false if !@dicom_header_info_by_bytes.nil? && @dicom_header_info_by_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  return false if @signed_image.nil?
  return false if @samples_per_pixel.nil?
  return false if @bits_allocated.nil?
  return false if @width.nil?
  return false if @height.nil?
  return false if @window_centre.nil?
  return false if @window_width.nil?
  return false if @pixel_representation.nil?
  return false if @rescale_intercept.nil?
  return false if @rescale_slope.nil?
  return false if @number_of_frames.nil?
  return false if @is_little_endian.nil?
  return false if @offset.nil?
  true
end