Unable to understand API /studies/:studiesId/series/:seriesID/instances/:instancesID/frames/:frames

I got an API calling “/studies/:studiesId/series/:seriesID/instances/:instancesID/frames/:frames” from OHIF.

I have checked all the possible ways but could not get…

  1. what data is sending in response
  2. how to send data in response

I am hitting this API in NODE using express js.

OHIF documentation described all the API but forget to describe frame API.
Its very difficult to understand by beginner.

It’s part of the DICOMweb standard, see e.g.

I have getting this API but dont know what data to be send from dicom file.

router.get(‘/studies/:studiesId/series/:seriesID/instances/:instancesID/frames/:frames’, (req, res) => {
var studiesId = req.params.studiesId
var seriesID = req.params.seriesID
var instancesID = req.params.instancesID
var frames = req.params.frames
var fs = require(‘fs’)

var dicomParser = require(‘dicom-parser’);
var fs = require(‘fs’)
var data = fs.readFileSync(“E:\bangladesh\Mams\MAMS_India_Today_Image\Dicom_files\11883014\DICOM\PN0\STUDY1\SERIES1\IMAGE1”)
try
{

  // Allow raw files
  const options = { TransferSyntaxUID: '1.2.840.10008.1.2' };
  // Parse the byte array to get a DataSet object that has the parsed contents
  var dataSet = dicomParser.parseDicom(data, options);
  // access a string element
  var studyInstanceUid = dataSet.string('x0020000d');
  console.log("studyInstanceUid",studyInstanceUid);

  // get the pixel data element (contains the offset and length of the data)
  var pixelDataElement = dataSet.elements.x7fe00010 || dataSet.elements.x7fe00008 || dataSet.elements.x7fe00009;
  var pixelData = new Uint8Array(dataSet.byteArray.buffer, pixelDataElement.dataOffset, pixelDataElement.length / 2);
  // var pixelData = new Uint8Array(dataSet.byteArray.buffer, pixelDataElement.dataOffset, pixelDataElement.length / 2);
  // var pixelData = new Uint16Array(dataSet.byteArray.buffer, pixelDataElement.dataOffset, pixelDataElement.length / 2);

  pixelData = `

${’ --6b4d1648-ee27-472d-9951-4192b5abff74’}
${‘Content-Location: E:\bangladesh\Mams\MAMS_India_Today_Image\Dicom_files\11883014\DICOM\PN0\STUDY1\SERIES1\IMAGE1’}
${‘Content-ID: d615df89-a84b-4569-96fd-b582fd026ca8@resteasy-multipart’}
${‘Content-Type: application/octet-stream’}

${pixelData}
${’ --6b4d1648-ee27-472d-9951-4192b5abff74–'}`

  res.send(pixelData)  // sending this data is giving mime type error

}
catch(ex)
{
console.log(‘Error parsing byte stream’, ex);
}