Skip to content

Commit

Permalink
handle color conversion while saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Apr 25, 2024
1 parent a58ffd9 commit 0250384
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions dicom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import cv2
import json
from pflog import pflog

__version__ = '1.1.5'
from pydicom.pixel_data_handlers import convert_color_space
import numpy as np
__version__ = '1.1.6'

DISPLAY_TITLE = r"""
_ _ _ __ _ _ _
Expand Down Expand Up @@ -103,7 +104,8 @@ def save_as_image(dcm_file, output_file_path, file_ext):
print(f"Saving output file as {output_file_path}")

# Prevents color inversion happening while saving as images
cv2.imwrite(output_file_path, cv2.cvtColor(pixel_array_numpy,cv2.COLOR_RGB2BGR))
rgb = convert_color_space(pixel_array_numpy, "YBR_FULL", "RGB")
cv2.imwrite(output_file_path,rgb)



Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
chris_plugin==0.2.1
opencv-python
pydicom==2.1.2
pydicom
pflog==1.2.26
pftel-client~=1.0.6
# for bug fix on transfer syntax errors
pylibjpeg
pylibjpeg-libjpeg
python-gdcm
python-gdcm

0 comments on commit 0250384

Please sign in to comment.