Skip to content

Commit

Permalink
added libraries to handle tansfer syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Apr 2, 2024
1 parent 57072c9 commit a58ffd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions dicom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from pathlib import Path
from argparse import ArgumentParser, Namespace, ArgumentDefaultsHelpFormatter

from pydicom.pixel_data_handlers import convert_color_space
from chris_plugin import chris_plugin, PathMapper
import pydicom as dicom
import cv2
import json
from pflog import pflog

__version__ = '1.1.4'
__version__ = '1.1.5'

DISPLAY_TITLE = r"""
_ _ _ __ _ _ _
Expand Down Expand Up @@ -101,9 +101,12 @@ def save_as_image(dcm_file, output_file_path, file_ext):
pixel_array_numpy = dcm_file.pixel_array
output_file_path = str(output_file_path).replace('dcm', 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))



def read_input_dicom(input_file_path, filters):
"""
1) Read an input dicom file
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
chris_plugin==0.2.1
opencv-python
pydicom
pydicom==2.1.2
pflog==1.2.26
pftel-client~=1.0.6
# for bug fix on transfer syntax errors
pylibjpeg
pylibjpeg-libjpeg
python-gdcm

0 comments on commit a58ffd9

Please sign in to comment.