Loading & saving classes

The classes described in this section are used to load and store DICOM structures (represented by the class ImebraDataSet).

The easiest way to load and store an ImebraDataSet object is by using the static methods of the ImebraCodecFactory class.

ImebraCodecFactory

class ImebraCodecFactory : public NSObject

The ImebraCodecFactory class can load or save a DataSet or an Image object using one of the codecs supplied by the Imebra library.

Public Static Functions

ImebraDataSet* ImebraCodecFactory::loadFromFile:error:(NSString * fileName, NSError ** pError)

Parses the content of the input file and returns a ImebraDataSet object representing it.

If none of the codecs supplied by Imebra is able to decode the file’s content then sets the pError parameter and returns nil.

Return
a ImebraDataSet object representing the input file’s content
Parameters
  • fileName: the name of the input file
  • pError: pointer to a NSError pointer that will be set in case of error

ImebraDataSet* ImebraCodecFactory::loadFromFileMaxSize:maxBufferSize:error:(NSString * fileName, unsigned int maxBufferSize, NSError ** pError)

Parses the content of the input file and returns a ImebraDataSet object representing it.

If none of the codecs supplied by Imebra is able to decode the file’s content then sets the pError parameter and returns nil.

Return
a ImebraDataSet object representing the input file’s content
Parameters
  • fileName: the name of the input file
  • maxSizeBufferLoad: the maximum size of the tags that are loaded immediately. Tags larger than maxSizeBufferLoad are left on the input stream and loaded only when a ImebraReadingDataHandler object or a ImebraWritingDataHandler object reference them.
  • pError: pointer to a NSError pointer that will be set in case of error

ImebraDataSet* ImebraCodecFactory::loadFromStream:error:(ImebraStreamReader * pReader, NSError ** pError)

Parses the content of the input stream and returns a ImebraDataSet representing it.

If none of the codecs supplied by Imebra is able to decode the stream’s content then sets the pError parameter and returns nil.

The read position of the ImebraStreamReader object is undefined when this method returns.

Return
an ImebraDataSet object representing the input stream’s content
Parameters
  • pReader: a ImebraStreamReader object connected to the input stream
  • pError: pointer to a NSError pointer that will be set in case of error

ImebraDataSet* ImebraCodecFactory::loadFromStreamMaxSize:maxBufferSize:error:(ImebraStreamReader * pReader, unsigned int maxBufferSize, NSError ** pError)

Parses the content of the input stream and returns a ImebraDataSet representing it.

If none of the codecs supplied by Imebra is able to decode the stream’s content then sets the pError parameter and returns nil.

The read position of the ImebraStreamReader object is undefined when this method returns.

Return
an ImebraDataSet object representing the input stream’s content
Parameters
  • pReader: a ImebraStreamReader object connected to the input stream
  • maxSizeBufferLoad: the maximum size of the tags that are loaded immediately. Tags larger than maxSizeBufferLoad are left on the input stream and loaded only when an ImebraReadingDataHandler or an ImebraWritingDataHandler object reference sthem.
  • pError: pointer to a NSError pointer that will be set in case of error

void ImebraCodecFactory::saveToFile:dataSet:codecType:error:(NSString * fileName, ImebraDataSet * pDataSet, ImebraCodecType_t codecType, NSError ** pError)

Saves the content of a ImebraDataSet object to a file.

Parameters
  • fileName: the name of the output file
  • pDataSet: the ImebraDataSet object to save
  • codecType: the codec to use to save the ImebraDataSet
  • pError: pointer to a NSError pointer that will be set in case of error

void ImebraCodecFactory::saveToStream:dataSet:codecType:error:(ImebraStreamWriter * pWriter, ImebraDataSet * pDataSet, ImebraCodecType_t codecType, NSError ** pError)

Saves the content of a ImebraDataSet object to an output stream using the requested codec.

Parameters
  • pWriter: an ImebraStreamWriter connected to the output stream
  • pDataSet: the ImebraDataSet object to save
  • codecType: the codec to use to save the ImebraDataSet
  • pError: pointer to a NSError pointer that will be set in case of error

void ImebraCodecFactory::setMaximumImageSize:maxHeight:(unsigned int maximumWidth, unsigned int maximumHeight)

Set the maximum image’s width & height accepted by Imebra.

By default both the maximum width and height are set to 4096 pixels.

Parameters
  • maximumWidth: the maximum image’s width accepted by Imebra
  • maximumHeight: the maximum image’s height accepted by Imebra