Esempio n. 1
0
        for dim in xrange(3):
            offsets[dim,
                    coords_reg[i:j,0],
                    coords_reg[i:j,1],
                    coords_reg[i:j,2]] = y[:,dim]

del x
_ = gc.collect()
            
irtk.imwrite( args.output + "/offsets_heart.nii.gz",
              offsets_heart )

hough_header = img.get_header()
hough_header['dim'][:3] += 2*args.padding

votes_heart = hough_votes(np.ascontiguousarray(np.round(offsets_heart).astype('int32')),
                            proba[1], padding=args.padding )

irtk.imwrite(args.output + "/votes_heart.nii.gz",
             irtk.Image(votes_heart,hough_header))

# mask using narrow_band
if args.padding:
    # update the narrow band without forgetting to
    # translate the brain_center
    narrow_band = get_narrow_band( votes_heart.shape,
                                   args.brain_center+args.padding,
                                   r_min=40,
                                   r_max=120 )

votes_heart[narrow_band==0] = 0
Esempio n. 2
0
_ = gc.collect()
            
if not args.score:            
    irtk.imwrite( args.output + "/offsets_left_lung.nii.gz",
                  offsets_left_lung )
    irtk.imwrite( args.output + "/offsets_right_lung.nii.gz",
                  offsets_right_lung )
    irtk.imwrite( args.output + "/offsets_heart.nii.gz",
                  offsets_heart )
    irtk.imwrite( args.output + "/offsets_liver.nii.gz",
                  offsets_liver )

hough_header = img.get_header()
hough_header['dim'][:3] += 2*args.padding

votes_left_lung = hough_votes(np.ascontiguousarray(np.round(offsets_left_lung).astype('int32')),
                            proba[1], padding=args.padding )
votes_right_lung = hough_votes(np.ascontiguousarray(np.round(offsets_right_lung).astype('int32')),
                            proba[2], padding=args.padding )
if not args.score:
    irtk.imwrite(args.output + "/votes_left_lung.nii.gz",
                 irtk.Image(votes_left_lung,hough_header))
    irtk.imwrite(args.output + "/votes_right_lung.nii.gz",
                 irtk.Image(votes_right_lung,hough_header))    

votes_heart = hough_votes(np.ascontiguousarray(np.round(offsets_heart).astype('int32')),
                            proba[3], padding=args.padding )
if not args.score:
    irtk.imwrite(args.output + "/votes_heart.nii.gz",
                 irtk.Image(votes_heart,hough_header))

votes_liver = hough_votes(np.ascontiguousarray(np.round(offsets_liver).astype('int32')),