7
7
import pydicom as dicom
8
8
from pydicom .dataset import Dataset , FileDataset
9
9
10
- from time import time
11
-
12
10
13
11
def write_dicom_slice (
14
12
pixel_array , # 2D array in LP orientation
15
13
filename = None ,
16
14
outputdir = "mydcmdir" ,
17
15
suffix = ".dcm" ,
18
16
modality = "PT" ,
19
- SecondaryCaptureDeviceManufctur = "KUL" ,
17
+ SecondaryCaptureDeviceManufacturer = "KUL" ,
20
18
uid_base = "1.2.826.0.1.3680043.9.7147." , # UID root for Georg Schramm
21
19
PatientName = "Test^Patient" ,
22
20
PatientID = "08150815" ,
@@ -62,7 +60,7 @@ def write_dicom_slice(
62
60
sl, frm : int, optional
63
61
slice and frame numbers that are appended to the file name prefix if given
64
62
65
- SecondaryCaptureDeviceManufctur --|
63
+ SecondaryCaptureDeviceManufacturer --|
66
64
uid_base |
67
65
PatientName |
68
66
PatientID |
@@ -76,7 +74,7 @@ def write_dicom_slice(
76
74
CorrectedImage | ... dicom tags that should be present in a minimal
77
75
ImageType | dicom header
78
76
RescaleSlope | see function definition for default values
79
- RescaleIntercept | default None means that they are creacted automatically
77
+ RescaleIntercept | default None means that they are created automatically
80
78
StudyInstanceUID |
81
79
SeriesInstanceUID |
82
80
SOPInstanceUID |
@@ -181,7 +179,7 @@ def write_dicom_slice(
181
179
ds .SOPInstanceUID = SOPInstanceUID
182
180
ds .SOPClassUID = file_meta .MediaStorageSOPClassUID
183
181
184
- ds .SecondaryCaptureDeviceManufctur = SecondaryCaptureDeviceManufctur
182
+ ds .SecondaryCaptureDeviceManufacturer = SecondaryCaptureDeviceManufacturer
185
183
186
184
## These are the necessary imaging components of the FileDataset object.
187
185
ds .SamplesPerPixel = 1
@@ -274,9 +272,7 @@ def write_dicom_slice(
274
272
275
273
if verbose :
276
274
print ("Writing file" , os .path .join (outputdir , filename ))
277
- dicom .filewriter .write_file (
278
- os .path .join (outputdir , filename ), ds , write_like_original = False
279
- )
275
+ dicom .dcmwrite (os .path .join (outputdir , filename ), ds , write_like_original = False )
280
276
281
277
return os .path .join (outputdir , filename )
282
278
0 commit comments