Skip to content

Commit

Permalink
moved loadZipDicom to dicomutils
Browse files Browse the repository at this point in the history
  • Loading branch information
dave3d committed Apr 13, 2020
1 parent 9bd25ec commit eb78337
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
19 changes: 1 addition & 18 deletions dicom2stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,30 +244,13 @@ def usage():

from utils import dicomutils

# Unzip a zipfile of dicom images into a temp directory, then
# load the series that has the most slices
#


def loadZipDicom(name):
print("Reading Dicom zip file:", name)
myzip = zipfile.ZipFile(name, 'r')

try:
myzip.extractall(tempDir)
except:
print("Zip extract failed")

return dicomutils.loadLargestSeries(tempDir)


# Load our Dicom data
#
if zipFlag:
# Case for a zip file of images
if verbose:
print("zip")
img, modality = loadZipDicom(fname[0])
img, modality = dicomutils.loadZipDicom(fname[0])


else:
Expand Down
16 changes: 16 additions & 0 deletions utils/dicomutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ def loadLargestSeries(dicomdir):
return img, modality


def loadZipDicom(name):
""" Unzip a zipfile of dicom images into a temp directory, then
load the series that has the most slices.
"""

print("Reading Dicom zip file:", name)
myzip = zipfile.ZipFile(name, 'r')

try:
myzip.extractall(tempDir)
except:
print("Zip extract failed")

return dicomutils.loadLargestSeries(tempDir)


#
# Main (test code)
#
Expand Down

0 comments on commit eb78337

Please sign in to comment.