Load Server URL dicom files inside Imebra in iOS?

374 Views Asked by At

I am using https://imebra.com/ in my application, when I load a local files it reading the DICOM file and I am able to see the Image. when, I am sending Cloud url path to imebra It is showing an error and below I shared sample code.I want to send a single or multiple url to Imebra. I don't know how to proceed.

 let filePath = Bundle.main.path(forResource: fileName, ofType: "dcm") // i want to send url(https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm) here
 let dataSet = try ImebraCodecFactory.load(fromFile: filepath)

  _ = try dataSet.getString(ImebraTagId(group: 0x10, tag: 0x10), elementNumber: 0, defaultValue: "")

  _ = try dataSet.getString(ImebraTagId(group: 0x10, tag: 0x10), elementNumber: 1, defaultValue: "")

thanks in advance.

1

There are 1 best solutions below

0
On

Imebra can load local DICOM files or from remote PACS (using the DIMSE protocol).

Imebra cannot load an image directly from an URL because it uses a posix call to open the local file.

To open a file from an URL you should first load the remote file. See this answer Simple Swift file download with URL to see how to load a file to a local temporary file.

Alternatively, you could load the file to a NSData object and pass its content to an Imebra Memory object, then pass to ImebraCodecFactory a StreamReader using a MemoryStreamInput.

Disclaimer: I'm the author of Imebra