def encode_in_segments(max_size, options={})
      @max_size = max_size
      @transfer_syntax = options[:syntax]
      # Until a DICOM write has completed successfully the status is 'unsuccessful':
      @write_success = false
      # Default explicitness of start of DICOM file:
      @explicit = true
      # Default endianness of start of DICOM files (little endian):
      @str_endian = false
      # When the file switch from group 0002 to a later group we will update encoding values, and this switch will keep track of that:
      @switched = false
      # Items contained under the Pixel Data element needs some special attention to write correctly:
      @enc_image = false
      # Create a Stream instance to handle the encoding of content to a binary string:
      @stream = Stream.new(nil, @str_endian)
      @segments = Array.new
      write_data_elements(children)
      # Extract the remaining string in our stream instance to our array of strings:
      @segments << @stream.export
      # Mark this write session as successful:
      @write_success = true
      return @segments
    end
def encode_in_segments(max_size, options={})
      @max_size = max_size
      @transfer_syntax = options[:syntax]
      # Until a DICOM write has completed successfully the status is 'unsuccessful':
      @write_success = false
      # Default explicitness of start of DICOM file:
      @explicit = true
      # Default endianness of start of DICOM files (little endian):
      @str_endian = false
      # When the file switch from group 0002 to a later group we will update encoding values, and this switch will keep track of that:
      @switched = false
      # Items contained under the Pixel Data element needs some special attention to write correctly:
      @enc_image = false
      # Create a Stream instance to handle the encoding of content to a binary string:
      @stream = Stream.new(nil, @str_endian)
      @segments = Array.new
      write_data_elements(children)
      # Extract the remaining string in our stream instance to our array of strings:
      @segments << @stream.export
      # Mark this write session as successful:
      @write_success = true
      return @segments
    end
Writes DICOM content to a series of size-limited binary strings, which is returned in an array.
 This is typically used in preparation of transmitting DICOM objects through network connections.

 @param [Integer] max_size the maximum segment string length
 @param [Hash] options the options to use for encoding the DICOM strings
 @option options [String] :syntax the transfer syntax used for the encoding settings of the post-meta part of the DICOM string
 @return [Array<String>] the encoded DICOM strings