Hi everyone, I am trying to do the following: Given a study with multiple series, identify one to process with an AI model that I have built. These are lung scans. The difference in series, is the convolution_kernel (0018|1210) used to reconsruct the CTs. They also have different slice counts, affecting the size on disk (in terms of MBs). In plane resolution is same in all cases.
My question is: given that my program will have to work with different vendors, should I look at SOP Instance UIDs or other such tags to identify the right (single) scan to pick to feed into the AI model? Feeding all scans will work but will increase the overall time spent from uploading the data to seeing the results (in my case user will wait until all series are processed through the model).
Greatly appreciate both responses! By scan I mean a series (collection of slices that make up a 3D image).
At the moment I am using CTs on disk, with the idea that whatever logic I build using pydicom, I will apply during PACS integration using Java.
I wanted to use convolution kernels but found out that vendors were not consistent with each other. I could do a survey with the academic center I am working with to list out all scanners and possible conv kernel options, maybe I will try that if I fail to find an alternative logic.
import numpy as np
from math import ceil
from pydicom import dcmread
from pydicom.encaps import decode_data_sequence
for _, folders, files in os.walk(folderPath):
for file in files:
dicom = dcmread(folderPath + "/" + file) tile_height = dicom[0x0028, 0x0010].value tile_width = dicom[0x0028, 0x0011].value frame_count = dicom[0x0028, 0x0008].value bits = dicom[0x0028, 0x0100].value pixels = dicom[0x7fe0, 0x0010].value frames = decode_data_sequence(pixels) rows = ceil(dicom[0x0048, 0x0007].value / self.tile_height) cols = ceil(dicom[0x0048, 0x0006].value / self.tile_width) samples_per_pixel = dicom[0x0028, 0x0002].value itr = 0 if bits == 8: bits_type = np.uint8 elif bits == 16: bits_type = np.uint16 elif bits == 32: bits_type = np.uint32 while( itr < frame_count): temp = np.frombuffer(frames[itr], dtype = bits_type) try: temp = cv2.imdecode(temp, cv2.IMREAD_COLOR) temp = temp.reshape(self.tile_height , self.tile_width, samples_per_pixel) except: return -6
Hello. I cleared the contents of the dicom file header and used the code below. The decom file that was opened with the decom viewer does not run. Is something wrong? Are any of the contents of the header information related to the file?
filename = "dcm file path"
Metadata = pydicom.dcmread(str(filename), stop_before_pixels=True)
for i in Metadata:
i.value = ""
MyAE = AE('ggg')#, [ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian]) MyAE.add_requested_context('1.2.840.10008.1.1', [ExplicitVRLittleEndian, ImplicitVRLittleEndian, ExplicitVRBigEndian]) MyAE.OnAssociateResponse = OnAssociateResponse # create association with remote AE print("Request association") assoc = MyAE.associate('url', 11112) if not assoc: print("Could not establish association") sys.exit(1) # perform a DICOM ECHO, just to make sure remote AE is listening print("DICOM Echo ... ",) # st = assoc.send_c_echo() # print('done with status "%s"' % st) # create some dataset folder_to_copy_in = 'string' for uid in os.listdir(os.path.join(root_folder, folder_to_copy_in)): for i in os.listdir(os.path.join(root_folder, folder_to_copy_in, uid)): d = pydicom.dcmread(os.path.join(root_folder, folder_to_copy_in, uid, i)) print("DICOM StoreSCU ... ",) try: st = assoc.send_c_store(d, 1)
RuntimeError: The association with a peer SCP must be established before sending a C-STORE requestand no idea how to fix