def encode_segments(max_size, transfer_syntax=IMPLICIT_LITTLE_ENDIAN)
      raise ArgumentError, "Invalid argument. Expected an Integer, got #{max_size.class}." unless max_size.is_a?(Integer)
      raise ArgumentError, "Argument too low (#{max_size}), please specify a bigger Integer." unless max_size > 16
      raise "Can not encode binary segments for an empty DICOM object." if children.length == 0
      encode_in_segments(max_size, :syntax => transfer_syntax)
    end
def encode_segments(max_size, transfer_syntax=IMPLICIT_LITTLE_ENDIAN)
      raise ArgumentError, "Invalid argument. Expected an Integer, got #{max_size.class}." unless max_size.is_a?(Integer)
      raise ArgumentError, "Argument too low (#{max_size}), please specify a bigger Integer." unless max_size > 16
      raise "Can not encode binary segments for an empty DICOM object." if children.length == 0
      encode_in_segments(max_size, :syntax => transfer_syntax)
    end
Encodes the DICOM object into a series of binary string segments with a specified maximum length.

 Returns the encoded binary strings in an array.

 @param [Integer] max_size the maximum allowed size of the binary data strings to be encoded
 @param [String] transfer_syntax the transfer syntax string to be used when encoding the DICOM object to string segments. When this method is used for making network packets, the transfer_syntax is not part of the object, and thus needs to be specified.
 @return [Array<String>] the encoded DICOM strings
 @example Encode the DObject to strings of max length 2^14 bytes
   encoded_strings = dcm.encode_segments(16384)