# anisotropy factor is the ratio between z voxel size and x/y voxel size. # if Isotropic -> 1.0 zAnisotropyFactor = 1.0; # this is typically a good value, but it depends on the voxel size of the data hessianSigma = 3.5 eigV1 = computeEigenVectorsOfHessianImage( img1, zAnisotropyFactor, hessianSigma ) eigV2 = computeEigenVectorsOfHessianImage( img2, zAnisotropyFactor, hessianSigma ) eigV3 = computeEigenVectorsOfHessianImage( img3, zAnisotropyFactor, hessianSigma ) # Train: note that we pass a list of stacks model.trainWithChannels( [img1,img2,img3], [eigV1, eigV2, eigV3], [gt1,gt2,gt3], [channels1,channels2,channels3], zAnisotropyFactor, numStumps=100, gtNegativeLabel=1, gtPositiveLabel=2, debugOutput=True) pred = model.predictWithChannels( img, eigV1, channels1, zAnisotropyFactor, useEarlyStopping=True) roi = ROICoordinates() roi.x2 = img.shape[2] - 1 roi.y2 = img.shape[1] - 1 roi.z1 = roi.z2 = img.shape[0] / 2 predSingleSlice = model.predictWithChannels( img, eigV1, channels1, zAnisotropyFactor, useEarlyStopping=True, subROI=roi) # show image & prediction side by side plt.ion() plt.figure() plt.subplot(1,3,1) plt.imshow(img[roi.z1,:,:],cmap="gray")
# anisotropy factor is the ratio between z voxel size and x/y voxel size. # if Isotropic -> 1.0 zAnisotropyFactor = 1.0; # this is typically a good value, but it depends on the voxel size of the data hessianSigma = 3.5 eigV1 = computeEigenVectorsOfHessianImage( img1, zAnisotropyFactor, hessianSigma ) eigV2 = computeEigenVectorsOfHessianImage( img2, zAnisotropyFactor, hessianSigma ) eigV3 = computeEigenVectorsOfHessianImage( img3, zAnisotropyFactor, hessianSigma ) # Train: note that we pass a list of stacks model.trainWithChannels( [img1,img2,img3], [eigV1, eigV2, eigV3], [gt1,gt2,gt3], [channels1,channels2,channels3], zAnisotropyFactor, numStumps=100, gtNegativeLabel=1, gtPositiveLabel=2, debugOutput=True) pred = model.predictWithChannels( img, eigV1, channels1, zAnisotropyFactor, useEarlyStopping=True) # show image & prediction side by side plt.ion() plt.figure() plt.subplot(1,2,1) plt.imshow(img[:,:,10],cmap="gray") plt.title("Click on the image to exit") plt.subplot(1,2,2) plt.imshow(pred[:,:,10],cmap="gray") plt.title("Click on the image to exit") plt.ginput(1)