def compute_for_channel(output_channel, input_channel):
            input_roi = numpy.array( (roi.start, roi.stop) )
            input_roi[:,-1] = (input_channel, input_channel+1)
            input_req = self.Input(*input_roi)

            # If possible, use the result array itself as a scratch area
            if self.Input.meta.dtype == result.dtype:
                input_req.writeInto( result[...,output_channel:output_channel+1] )        

            input_data = input_req.wait()
            input_data = input_data.astype(numpy.float32, order='C', copy=False)
            input_data = input_data[...,0] # drop channel axis
            result[..., output_channel] = computeIntegralImage(input_data)
        def compute_for_channel(output_channel, input_channel):
            input_roi = numpy.array( (roi.start, roi.stop) )
            input_roi[:,-1] = (input_channel, input_channel+1)
            input_req = self.Input(*input_roi)

            # If possible, use the result array itself as a scratch area
            if self.Input.meta.dtype == result.dtype:
                input_req.writeInto( result[...,output_channel:output_channel+1] )        

            input_data = input_req.wait()
            input_data = input_data.astype(numpy.float32, order='C', copy=False)
            input_data = input_data[...,0] # drop channel axis
            result[..., output_channel] = computeIntegralImage(input_data)
예제 #3
0
import matplotlib.pyplot as plt

# load data
gt = joblib.load("../../testData/gt.jlb")
img = joblib.load("../../testData/img.jlb")

# let's pretend we have 3 image stacks with different number of ROIs
# with its corresponding gt and 2 feature channels

img3 = img2 = img1 = img
gt3  =  gt2 =  gt1 = gt

model = Booster()

imgFloat = np.float32(img)
iiImage = computeIntegralImage( imgFloat )

# again, this is stupid, just presume the second channel is a different feature
channel1 = iiImage
channel2 = iiImage
channels3 = channels2 = channels1 = [channel1,channel2]

# 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 )