question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image discoloration for JPEG encapsulated in DICOM received from Orthanc dicom-web endpoint

See original GitHub issue

I have seen other entries for this issue, however:

  • I’ve done a C-MOVE of the study from this instance to a separate orthanc server, and there was no discoloration in its OHIF Viewer
  • I’ve viewed the DICOM sent to this in Horus, and there was no discoloration

I think at this point it’s an OHIF Viewer issue, rather than an orthanc issue. I’m not entirely sure if the viewing is affected by whether or not the image is HDR, the photometric interpretation, the compression bits, the or the endianness, or sending an image that is “compressed” as “uncompressed,” because technically we didn’t compress the image we wrapped.

Bug Report

Describe the Bug

When viewing a JPEG encapsulated in DICOM and sent to an Orthanc server, the image appears discolored.

What steps can we follow to reproduce the bug?

  1. Send either of the following DICOM files:
  2. Navigate to the patient entry in the ohif viewer.

I’ve exposed a public ohif viewer server at https://ohif-test.immd.club. Its DICOM destination is ORTHANC@ohif-test.immd.club:4242.

docker-compose.ohif.yml

version: '3.6'
services:
  mongo:
    container_name: mongo
    image: "mongo:latest"
    restart: always
  proxy:
    container_name: nginx
    image: nginx
    restart: always
    volumes:
      - ./configs/ohif-config/nginx.conf:/etc/nginx/conf.d/default.conf
  caddy:
    container_name: caddy
    restart: always
    image: "imagemovermd/caddy:latest"
    build: 
      context: .
      dockerfile: ./configs/caddy-config/Dockerfile
    volumes:
      - ./configs/ohif-config/caddy/certs:/root/.caddy  # to save certificates on disk
      - ./configs/ohif-config/Caddyfile:/etc/Caddyfile  # to mount custom Caddyfile
    environment:
      - CADDYPATH=${HOME}/.caddy
      - CADDY_DESTINATION_PORT=${CADDY_DESTINATION_PORT:-80}
      - CADDY_DESTINATION=${CADDY_DESTINATION:-nginx}
      - CADDY_FQDN=${CADDY_FQDN:-ohif-test.immd.club}
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - proxy
  orthanc:
    container_name: orthanc
    image: jodogne/orthanc-plugins@sha256:23170f256c71018f1f167bbf9892841ca281a2a6c28092989f26939e924552c3
    restart: always
    ports:
      - "4242:4242"
    command: ["--verbose","/etc/orthanc/orthanc.json" ]
    # network_mode: host
    volumes:
       - ./configs/ohif-config/orthanc.json:/etc/orthanc/orthanc.json
  viewer:
    container_name: viewer
    image: ohif/viewer@sha256:8b333bc716760a5b48fc0be1948b66de60fc539a14c9f4b2f95df03b0528b7e8
    restart: always
    environment:
      - MONGO_URL=mongodb://mongo:27017/ohif
      - PUBLIC_URL=http://34.220.35.158/
    extra_hosts:
      - "pacsip:127.0.0.1"
      - "pacsIP:127.0.0.1"
    volumes:
      - ./configs/ohif-config/ohif.json:/app/app.json
      - ./configs/ohif-config/ohif.js:/usr/share/nginx/html/app-config.js

Docker images:

Container       Repository           Tag         Image Id      Size  
---------------------------------------------------------------------
caddy       imagemovermd/caddy   latest        d86693c25e35   126 MB 
mongo       mongo                latest        a0e2e64ac939   347 MB 
nginx       nginx                latest        f7bb5701a33c   120 MB 
orthanc     <none>               <none>        2470fac3bb72   192 MB 
viewer      ohif/viewer          v2.2.0.5809   9349ecd0cf11   38.8 MB

Exif data:

# zoey.jpg
ExifTool Version Number         : 10.80
File Name                       : 2.jpg
Directory                       : .
File Size                       : 126 kB
File Modification Date/Time     : 2020:01:09 19:54:31+00:00
File Access Date/Time           : 2020:01:09 19:54:25+00:00
File Inode Change Date/Time     : 2020:01:09 19:54:31+00:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : Apple
Camera Model Name               : iPhone 6 Plus
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : 10.3.1
Modify Date                     : 2017:06:28 00:07:17
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/4
F Number                        : 2.2
Exposure Program                : Program AE
ISO                             : 160
Exif Version                    : 0221
Date/Time Original              : 2017:06:28 00:07:17
Create Date                     : 2017:06:28 00:07:17
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/4
Aperture Value                  : 2.2
Brightness Value                : -2.841885824
Exposure Compensation           : 0
Metering Mode                   : Multi-segment
Flash                           : Auto, Did not fire
Focal Length                    : 4.2 mm
Subject Area                    : 1631 1223 1795 1077
Run Time Flags                  : Valid
Run Time Value                  : 34700732138750
Run Time Epoch                  : 0
Run Time Scale                  : 1000000000
Acceleration Vector             : 0.07252224291 -0.9839130435 -0.08616925645
Sub Sec Time Original           : 544
Sub Sec Time Digitized          : 544
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 1220
Exif Image Height               : 1320
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
White Balance                   : Auto
Focal Length In 35mm Format     : 29 mm
Scene Capture Type              : Standard
Image Unique ID                 : 5246bf598847076e0000000000000000
Lens Info                       : 4.15mm f/2.2
Lens Make                       : Apple
Lens Model                      : iPhone 6 Plus back camera 4.15mm f/2.2
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Longitude Ref               : West
GPS Altitude Ref                : Above Sea Level
GPS Time Stamp                  : 04:07:17
GPS Speed Ref                   : km/h
GPS Speed                       : 0.006269935961
GPS Img Direction Ref           : True North
GPS Img Direction               : 94.31746032
GPS Dest Bearing Ref            : True North
GPS Dest Bearing                : 94.31746032
GPS Date Stamp                  : 2017:06:28
GPS Horizontal Positioning Error: 200 m
Compression                     : JPEG (old-style)
Thumbnail Offset                : 2228
Thumbnail Length                : 4240
Image Width                     : 1220
Image Height                    : 1320
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Aperture                        : 2.2
GPS Altitude                    : 31.1 m Above Sea Level
GPS Date/Time                   : 2017:06:28 04:07:17Z
GPS Latitude                    : 28 deg 34' 42.31" N
GPS Longitude                   : 81 deg 12' 29.51" W
GPS Position                    : 28 deg 34' 42.31" N, 81 deg 12' 29.51" W
Image Size                      : 1220x1320
Megapixels                      : 1.6
Run Time Since Power Up         : 9:38:20
Scale Factor To 35 mm Equivalent: 7.0
Shutter Speed                   : 1/4
Create Date                     : 2017:06:28 00:07:17.544
Date/Time Original              : 2017:06:28 00:07:17.544
Thumbnail Image                 : (Binary data 4240 bytes, use -b option to extract)
Circle Of Confusion             : 0.004 mm
Field Of View                   : 63.7 deg
Focal Length                    : 4.2 mm (35 mm equivalent: 29.0 mm)
Hyperfocal Distance             : 1.82 m
Light Value                     : 3.6



# zoey.dcm 

ExifTool Version Number         : 10.80
File Name                       : 2.dcm
Directory                       : .
File Size                       : 128 kB
File Modification Date/Time     : 2020:01:09 19:54:31+00:00
File Access Date/Time           : 2020:01:09 22:53:23+00:00
File Inode Change Date/Time     : 2020:01:09 19:54:31+00:00
File Permissions                : rw-r--r--
File Type                       : DICOM
File Type Extension             : dcm
MIME Type                       : application/dicom
File Meta Info Group Length     : 178
File Meta Info Version          : 0 1
Media Storage SOP Class UID     : Secondary Capture Image Storage
Media Storage SOP Instance UID  : 1.2.826.0.1.3680043.9.3574.999.5.20091354.3.2
Transfer Syntax UID             : JPEG Baseline (Process 1)
Implementation Class UID        : 1.2.40.0.13.1.1
Implementation Version Name     : dcm4che-3.3.7
Specific Character Set          : ISO_IR 100
Image Type                      : ORIGINAL\PRIMARY
Instance Creation Date          : 2020:01:09
Instance Creation Time          : 13:54:25.655
SOP Class UID                   : Secondary Capture Image Storage
SOP Instance UID                : 1.2.826.0.1.3680043.9.3574.999.5.20091354.3.2
Study Date                      : 2020:01:09
Series Date                     : 2020:01:09
Acquisition Date                : 2017:06:28
Content Date                    : 2017:06:28
Study Time                      : 13:54:22.972
Series Time                     : 13:54:22.972
Acquisition Time                : 04:07:17.000
Content Time                    : 04:07:17.000
Accession Number                : 999000000033
Modality                        : VL
Conversion Type                 : SI
Manufacturer                    : ImageMoverMD
Referring Physician Name        : 
Study Description               : DERM PHOTO
Series Description              : PHOTO
Institutional Department Name   : 
Physicians Of Record            : 
Performing Physician Name       : 
Performing Physician ID Sequence: 
Person Identification Code Sequence: 
Institution Name                : 
Code Value                      : 
Coding Scheme Designator        : NPI
Code Meaning                    : Provider ID
End Of Items                    : 
Name Of Physician Reading Study : 
Operators Name                  : 
Manufacturers Model Name        : ImageMover
Patient Name                    : 
Patient ID                      : 123
Issuer Of Patient ID            : 
Patient Birth Date              : 
Patient Sex                     : 
Body Part Examined              : 
Software Version                : 2.0.0
Study Instance UID              : 1.2.826.0.1.3680043.9.3574.999.5.20091354
Series Instance UID             : 1.2.826.0.1.3680043.9.3574.999.5.20091354.3
Study ID                        : 3
Series Number                   : 200
Instance Number                 : 1
Patient Orientation             : 
Laterality                      : 
Samples Per Pixel               : 3
Photometric Interpretation      : YBR_FULL_422
Planar Configuration            : 0
Rows                            : 1320
Columns                         : 1220
Bits Allocated                  : 8
Bits Stored                     : 8
High Bit                        : 7
Pixel Representation            : Unsigned
Lossy Image Compression         : 01
Requesting Physician            : 
Patient Institution Residence   : Outpatient
Pixel Data                      : (Binary data 0 bytes, use -b option to extract)
Start Of Item                   : (Binary data 129398 bytes, use -b option to extract)
End Of Sequence                 : 

dragonquest5

dragonquest.dcm 
ExifTool Version Number         : 10.80
File Name                       : 3.dcm
Directory                       : tmp/pronghorn/uploads
File Size                       : 4.7 MB
File Modification Date/Time     : 2020:01:06 20:48:11+00:00
File Access Date/Time           : 2020:01:06 20:48:11+00:00
File Inode Change Date/Time     : 2020:01:06 20:48:11+00:00
File Permissions                : rw-r--r--
File Type                       : DICOM
File Type Extension             : dcm
MIME Type                       : application/dicom
File Meta Info Group Length     : 178
File Meta Info Version          : 0 1
Media Storage SOP Class UID     : Secondary Capture Image Storage
Media Storage SOP Instance UID  : 1.2.826.0.1.3680043.9.3574.999.8.20061448.8.3
Transfer Syntax UID             : JPEG Baseline (Process 1)
Implementation Class UID        : 1.2.40.0.13.1.1
Implementation Version Name     : dcm4che-3.3.7
Specific Character Set          : ISO_IR 100
Image Type                      : ORIGINAL\PRIMARY
Instance Creation Date          : 2020:01:06
Instance Creation Time          : 14:48:11.355
SOP Class UID                   : Secondary Capture Image Storage
SOP Instance UID                : 1.2.826.0.1.3680043.9.3574.999.8.20061448.8.3
Study Date                      : 2020:01:06
Series Date                     : 2020:01:06
Acquisition Date                : 2019:12:21
Content Date                    : 2019:12:21
Study Time                      : 14:48:05.834
Series Time                     : 14:48:05.834
Acquisition Time                : 23:01:22.000
Content Time                    : 23:01:22.000
Accession Number                : 999000000026
Modality                        : VL
Conversion Type                 : SI
Manufacturer                    : ImageMoverMD
Referring Physician Name        : 
Study Description               : DERM PHOTO
Series Description              : PHOTO
Institutional Department Name   : 
Physicians Of Record            : 
Performing Physician Name       : 
Performing Physician ID Sequence: 
Person Identification Code Sequence: 
Institution Name                : 
Code Value                      : 
Coding Scheme Designator        : NPI
Code Meaning                    : Provider ID
End Of Items                    : 
Name Of Physician Reading Study : 
Operators Name                  : 
Manufacturers Model Name        : ImageMover
Patient Name                    : 
Patient ID                      : 123
Issuer Of Patient ID            : 
Patient Birth Date              : 
Patient Sex                     : 
Body Part Examined              : 
Software Version                : 2.0.0
Study Instance UID              : 1.2.826.0.1.3680043.9.3574.999.8.20061448
Series Instance UID             : 1.2.826.0.1.3680043.9.3574.999.8.20061448.8
Study ID                        : 8
Series Number                   : 200
Instance Number                 : 1
Patient Orientation             : 
Laterality                      : 
Samples Per Pixel               : 3
Photometric Interpretation      : YBR_FULL_422
Planar Configuration            : 0
Rows                            : 4032
Columns                         : 3024
Bits Allocated                  : 8
Bits Stored                     : 8
High Bit                        : 7
Pixel Representation            : Unsigned
Lossy Image Compression         : 01
Requesting Physician            : 
Patient Institution Residence   : Outpatient
Pixel Data                      : (Binary data 0 bytes, use -b option to extract)
Start Of Item                   : (Binary data 4901334 bytes, use -b option to extract)
End Of Sequence                 : 


dragonquest.jpg 
ExifTool Version Number         : 10.80
File Name                       : 3.jpg
Directory                       : tmp/pronghorn/uploads
File Size                       : 4.7 MB
File Modification Date/Time     : 2020:01:06 20:48:07+00:00
File Access Date/Time           : 2020:01:06 20:48:10+00:00
File Inode Change Date/Time     : 2020:01:06 20:48:10+00:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Make                            : Google
Camera Model Name               : Pixel 3a
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : HDR+ 1.0.265696846zdh
Modify Date                     : 2019:12:21 17:01:22
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/60
F Number                        : 1.8
Exposure Program                : Program AE
ISO                             : 157
Exif Version                    : 0231
Date/Time Original              : 2019:12:21 17:01:22
Create Date                     : 2019:12:21 17:01:22
Offset Time                     : -06:00
Offset Time Original            : -06:00
Offset Time Digitized           : -06:00
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/60
Aperture Value                  : 1.8
Brightness Value                : 1.95
Exposure Compensation           : 0
Max Aperture Value              : 1.8
Subject Distance                : 0.659 m
Metering Mode                   : Center-weighted average
Flash                           : Off, Did not fire
Focal Length                    : 4.4 mm
Warning                         : [minor] Unrecognized MakerNotes
Sub Sec Time                    : 202982
Sub Sec Time Original           : 202982
Sub Sec Time Digitized          : 202982
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 4032
Exif Image Height               : 3024
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Custom Rendered                 : Custom
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 0
Focal Length In 35mm Format     : 27 mm
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Subject Distance Range          : Macro
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Longitude Ref               : West
GPS Altitude Ref                : Above Sea Level
GPS Time Stamp                  : 23:01:22
GPS Dilution Of Precision       : 13.544
GPS Processing Method           : fused
GPS Date Stamp                  : 2019:12:21
Compression                     : JPEG (old-style)
Thumbnail Offset                : 18664
Thumbnail Length                : 5643
Image Width                     : 3024
Image Height                    : 4032
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Aperture                        : 1.8
GPS Altitude                    : 251 m Above Sea Level
GPS Date/Time                   : 2019:12:21 23:01:22Z
GPS Latitude                    : 43 deg 6' 11.18" N
GPS Longitude                   : 89 deg 17' 47.59" W
GPS Position                    : 43 deg 6' 11.18" N, 89 deg 17' 47.59" W
Image Size                      : 3024x4032
Megapixels                      : 12.2
Scale Factor To 35 mm Equivalent: 6.1
Shutter Speed                   : 1/60
Create Date                     : 2019:12:21 17:01:22.202982-06:00
Date/Time Original              : 2019:12:21 17:01:22.202982-06:00
Modify Date                     : 2019:12:21 17:01:22.202982-06:00
Thumbnail Image                 : (Binary data 5643 bytes, use -b option to extract)
Circle Of Confusion             : 0.005 mm
Depth Of Field                  : 0.43 m (0.51 - 0.94 m)
Field Of View                   : 67.4 deg
Focal Length                    : 4.4 mm (35 mm equivalent: 27.0 mm)
Hyperfocal Distance             : 2.22 m
Light Value                     : 6.9

dicom.zip

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jajimgmecommented, Apr 24, 2020

Hi, I have been using the viewer for a few weeks and have ecountered the same problem. @cutecycle I think is not related to the viewer itself but to the image, in our case changing the jpeg codification type from JPEGBaseline to LittlelEndianExplicit while generating the DICOM did the trick! I am no expert on the matter but hopefully you or anyone that gets here from google could find some direction to look into.

0reactions
jeffmartinacommented, Jun 25, 2020

We are also facing the same problem. We asked the supplier to change the devices’ compression to JPEGBaseline in order to save some space. Now we are faced with this.

Changing it back to LittleEndian would work like @jajimgme, but that would mean for us waiting weeks for the suppliers to come back.

Does anybody know what is causing the problem?

Artboard@1x

Read more comments on GitHub >

github_iconTop Results From Across the Web

F Encapsulated Images As Part of A DICOM Message ...
After unpacking the DICOM message, the encoded data stream can be fully reconstructed at the receiving node. b) The object definition of the...
Read more >
DICOMweb plugin — Orthanc Book documentation
This official plugin extends Orthanc with support of the DICOMweb protocols. More precisely, the plugin introduces a basic, reference implementation of ...
Read more >
DICOMweb Tag.RetrieveURL behind reverse proxy
I am trying to setup Weasis to work via DICOMweb with 2 load-balanced Orthanc instances. They are served by NGINX under the URI...
Read more >
DICOMweb Client Documentation
The dicomweb-client build distribution provides client intefaces ... Retrieve a set of frames of a given instances as JPEG compressed image:.
Read more >
How to use osimis/orthanc Docker images
The Orthanc DICOMweb plugin must be enabled explicitly. Notice: This plugin allows queries and transfers to and from GCP DICOM stores, it does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found