Size is (121,512,512). Error is coming as : IndexError: index 152 is out of bounds for axis 0 with size 121.

0 votes
def nodule_detect(nodules,j,numpyImage, numpyOrigin, numpySpacing):
    #g = "input/subset"+str(k)+"/"+j
    #numpyImage, numpyOrigin, numpySpacing = load_itk_image(j)
    #jj = j.split("/")
    #jj = jj[-1]
    numpyImage = normalize(numpyImage)
    print("Inside nodule-detect",numpyImage)
    for i in range(len(nodules)):
        vals = nodules.loc[i]
        #print(j)
        #print("In nodule-detect")
        jj = j.split("/")
        jj = jj[-1]
        if(vals['seriesuid'] == (jj.replace(".mhd",""))):
            print("Inside the nodule")
            worldCoord = np.asarray([float(vals["coordX"]),float(vals["coordY"]),float(vals["coordZ"])])
            print(worldCoord)
            voxelCoord = worldToVoxelCoord(worldCoord, numpyOrigin, numpySpacing)
            print(voxelCoord)
            voxelCoord = voxelCoord
            voxelWidth = 65
            print("VoxelCoord :",voxelCoord[0])
            print("Welcome")
            patch = numpyImage[int(voxelCoord[0]),int(voxelCoord[1])- int(voxelWidth/2):int(voxelCoord[1])+int(voxelWidth/2),int(voxelCoord[2])-int(voxelWidth/2):int(voxelCoord[2])+int(voxelWidth/2)]
            patch = normalizePlanes(patch)
            print (worldCoord)
            print (voxelCoord)
            print (patch)
            outputDir = 'patches/'
            plt.imshow(patch, cmap='gray')
            plt.show()
            #outputDir = 'patches/'
            plt.savefig('patch'+".png")
            Image.fromarray(patch*255).convert('L').save(os.path.join(outputDir,'patch_'+ str(worldCoord[0]) + '_' + str(worldCoord[1]) + '_' + str(worldCoord[2]) +'.tiff'))
Jan 28 by anonymous
• 150 points
35 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions

0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 627 views
0 votes
0 answers
0 votes
0 answers

Python error "IndexError: list index out of range"

I am trying to execute the following ...READ MORE

Jun 17, 2019 in Python by Alok
3,924 views
0 votes
1 answer

Error: Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet

Since you are using the lower version ...READ MORE

answered Jun 20, 2018 in Azure by null_void
• 3,220 points
1,891 views
0 votes
1 answer

Firefox Error: “Your connection is not secure” while launching driver with Selenium 3.0.1 using Java

Download Firefox 55 beta and set capabilities.setCapability("acceptInsecureCerts", true); Here ...READ MORE

answered Sep 17, 2018 in Selenium by Meci Matt
• 9,460 points
511 views
0 votes
1 answer

Error while spying the element Index : outside the bounds of the array :BluePrism Java app

Only for 64-bit windows 7 or higher version ...READ MORE

answered Oct 24, 2018 in RPA by Priyaj
• 57,530 points
637 views
0 votes
1 answer

"subscript out of bounds" error in while executing simple R program

This is caused by trying to access ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 51,810 points
166 views
0 votes
1 answer

“subscript out of bounds” Error in r programming

This error is likely to occur when ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 51,810 points
3,068 views