Skip to content

Commit

Permalink
read_file -> pydicom.dcmread (#174)
Browse files Browse the repository at this point in the history
* read_file -> pydicom.dcmread

* Import pydicom instead of the dicomio module
  • Loading branch information
darrencl authored Sep 13, 2024
1 parent 0204980 commit b3cece4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions suspect/image/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def load_dicom_volume(filename):
"""
_, file_ext = os.path.splitext(filename)
# load the supplied file and get the UID of the series
ds = pydicom.read_file(filename)
ds = pydicom.dcmread(filename)
seriesUID = ds.SeriesInstanceUID

# get the position of the image
Expand All @@ -49,7 +49,7 @@ def normal_distance(coords):
if name.endswith(file_ext): # name.lower().endswith(".ima") or name.lower().endswith(".dcm"):
new_dicom_name = os.path.join(folder, name)
try:
new_ds = pydicom.read_file(new_dicom_name)
new_ds = pydicom.dcmread(new_dicom_name)
except pydicom.errors.InvalidDicomError as e:
continue

Expand Down
4 changes: 2 additions & 2 deletions suspect/io/dicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from ._common import complex_array_from_iter

import pydicom.dicomio
import pydicom
import pydicom.tag


Expand All @@ -22,7 +22,7 @@ def load_dicom(filename):
MRSData
The loaded data from the file
"""
dataset = pydicom.dicomio.read_file(filename)
dataset = pydicom.dcmread(filename)

# format for metadata dictionary elements:
# {'key': [[dicom_tag], required], ...}
Expand Down
6 changes: 3 additions & 3 deletions suspect/io/siemens.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pydicom.tag
import pydicom.dicomio
import pydicom
import numpy
import struct
import warnings
Expand Down Expand Up @@ -105,7 +105,7 @@ def load_siemens_dicom(filename):
# the .IMA format is a DICOM standard, unfortunately most of the information is contained inside a private and very
# complicated header with its own data storage format, we have to get that information out along with the data
# start by reading in the DICOM file completely
dataset = pydicom.dicomio.read_file(filename)
dataset = pydicom.dcmread(filename)
# now look through the tags (0029, 00xx) to work out which xx refers to the csa header
# xx seems to start at 10 for Siemens
xx = 0x0010
Expand Down Expand Up @@ -210,7 +210,7 @@ def load_siemens_dicom(filename):
# :param anonymized_filename:
# :return:
# """
# dataset = pydicom.dicomio.read_file(filename)
# dataset = pydicom.dcmread(filename)
# print(dataset.PatientName)
# xx = 0x0010
# header_index = 0
Expand Down

0 comments on commit b3cece4

Please sign in to comment.