Serve wado data for cornerstone3D core samples

What wadors service do I need to serve my own data for cornerstone3D core samples?

  • I am not using OHIF yet, just using cornerstone3D.
  • I can run some of the example code (for example, the StackAPI example) from my local node.js server. But the image data is still grabbed from a remote wadoRsRoot: ‘OHIF Viewer’. I have tried to change it to use my local wadoRs server, which is written in Python/Flask. I implemented two REST APIs:
    @app.route(‘/dicomweb/studies/<study>/series/<series>/metadata’)
    def dicomweb_series_metadata(study, series):

    and
    @app.route(‘/dicomweb/studies/<study>/series/<series>/instances/<instance>/frames/’)
    def dicomweb_frame_request(study, series, instance, frame):

After I changed the content in the function createImageIdsAndCacheMetaData to my new content:
const imageIds = await createImageIdsAndCacheMetaData({
StudyInstanceUID:
‘1.2.840.114350.2.451.2.798268.2.2223165640889.1’,
SeriesInstanceUID:
‘1.3.12.2.1107.5.2.0.79033.2023081714393310356502759.0.0.0’,
wadoRsRoot: ‘http://localhost:3000/dicomweb’,
});

I got nothing (no images) in the web browser (StackAPI example). I don’t see any errors on the Browser’s development tool page.

Here is the code details of my 2nd wadoRs service:

@app.route(‘/dicomweb/studies/<study>/series/<series>/instances/<instance>/frames/<frame>’)
def dicomweb_frame_request(study, series, instance, frame):

# Construct the path to the DICOM file
dicom_path = f"{DICOM_SERIES_DIR}/{instance}.dcm"
temp_jls_frame_path = '/workspaces/SyntheticMRI/temp_jls_frame.dcm'

try:
    
    ret = changeToJpeg_JLS_format(dicom_path, temp_jls_frame_path)
    if ret > 0:
        return
    
    # Read the compressed tmp jls DICOM file using pydicom
    ds = pydicom.dcmread(temp_jls_frame_path)
            
    # Create a BytesIO object for the multipart response
    output = io.BytesIO()
    
    # Add a boundary between metadata and pixel data
    output.write(b'--boundary\r\n')
    output.write(b'Content-Type: image/jls;transfer-syntax=1.2.840.10008.1.2.4.80\r\n\r\n')

    # Write JLS image data:
    output.write(pydicom.encaps.decode_data_sequence(ds.PixelData)[0])

    # Add closing boundary
    output.write(b'\r\n--boundary\r\n')

    output.seek(0)

    # Send the DICOM frame data as a multipart response
    return send_file(output, mimetype='multipart/related; type=image/jpeg-ls; boundary=boundary', as_attachment=True, download_name="test.mht")

Could anyone please analyze the reason for me - why cannot I see images loaded in the viewer in browsers? What’s wrong with my REST api function?

Thanks!
xjyangxj