Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Img_Bimask fails to handle float numbers (RyrexReader.py) #7

Open
ivanzhovannik opened this issue Feb 15, 2018 · 0 comments
Open

Img_Bimask fails to handle float numbers (RyrexReader.py) #7

ivanzhovannik opened this issue Feb 15, 2018 · 0 comments

Comments

@ivanzhovannik
Copy link

Hi,

I have got errors because sliceOK cannot be defined if Cportion_rt or/and img_vol[i].ImagePositionPatient[2] are float numbers. I changed some lines to find the closest distance between both.

I do not know what sliceOK is. If possible make some comments. :)

# Check DICOM file Modality
if IM.Modality == 'CT' or 'PT':
    for k in range(len(M.ROIContourSequence[ROI_id].ContourSequence)):    
        Cpostion_rt = M.ROIContourSequence[ROI_id].ContourSequence[k].ContourData[2]
        
        # ? generate a vector of ImagePositionPatient[2]
        # usage get_ImagePositionPatient(index, img_vol)
        get_ImagePositionPatient = lambda x, y: y[x].ImagePositionPatient[2]
        list_get_IPP = np.zeros((num_slice,))
        for i in range(num_slice): # ?? map()
            list_get_IPP[i] = get_ImagePositionPatient(i, img_vol)
        sliceOK = np.argmin(np.abs(Cpostion_rt - list_get_IPP))
        print(sliceOK)
        '''
        for i in range(num_slice):
            if Cpostion_rt == img_vol[i].ImagePositionPatient[2]:
                sliceOK = i
                break
        '''	
        x=[]
        y=[]
        z=[]
        
        m=M.ROIContourSequence[ROI_id].ContourSequence[k].ContourData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant