반응형 컴퓨터쟁이90 error: OpenCV(4.5.3) :-1: error: (-5:Bad argument) in function 'circle' - img = array_patient[:,:, img_shape[2]//2] 인 상태에서 사용했을 경우에 이러한 오류가 난다. error: OpenCV(4.5.3) :-1: error: (-5:Bad argument) in function 'circle' > Overload resolution failed: > - Layout of the output array img is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels) > - Expected Ptr for argument 'img' - img2 = array_patient[:,:, img_shape[2]//2].copy() .copy()를 사용.. 2022. 3. 2. DICOM image 회전 시키기 DICOM인 CT영상이미지를 3가지의 면으로 확인을 하기 위한 코드를 찾았다. a2를 보면 이미지가 90도 회전이 필요한 것을 알 수 있다. 따라서 회전을 하기 위해서 코드를 어떤 함수를 써야하는지 이것저것 찾았었는데, np.rot90() 함수를 사용하면 된다. [수정 전 코드] for i, s in enumerate(slices): img2d = s.pixel_array img3d[:, :, i] = img2d # plot 3 orthogonal slices a1 = plt.subplot(2, 2, 1) plt.imshow(img3d[:, :, img_shape[2]//2]) a1.set_aspect(ax_aspect) a2 = plt.subplot(2, 2, 2) plt.imshow(img3d[:, .. 2022. 2. 15. DICOM preprocessing [python code] # # Loop over the image files and store everything into a list. # def load_scan(path): slices = [dicom.read_file(path + '/' + s) for s in os.listdir(path)] slices.sort(key = lambda x: int(x.InstanceNumber)) try: slice_thickness = np.abs(slices[0].ImagePositionPatient[2] - slices[1].ImagePositionPatient[2]) except: slice_thickness = np.abs(slices[0].SliceLocation - slices[1].SliceLo.. 2022. 2. 14. DICOM meta data 사용한 속성 정리 1. Instance Number Attribute TagTypeKeywordValue MultiplicityValue RepresentationExample Values (0020,0013) Required, Empty if Unknown (2) InstanceNumber 1 Integer String (IS) 1 2 41 A number that identifies this image. Note This Attribute was named Image Number in earlier versions of this Standard. 2. Image Position (Patient) Attribute TagTypeKeywordValue MultiplicityValue RepresentationExample.. 2022. 2. 14. 이전 1 2 3 4 5 6 7 ··· 23 다음 728x90 반응형