Exemple #1
0
def findCaries(imgNameInput):
    print imgNameInput

    if os.path.exists(imgNameInput):

        inImg = readImage(imgNameInput)
        outImg = segmentImage(inImg)
        viewImage(outImg)
        # raw_input('Press <Return> to continue')
        # writeImage(imgNameOutput,binaryThrFiltered.GetOutput())

    else:
        print "Eingabedatei existiert nicht"
Exemple #2
0
import time, argparse, imageIO, log
from gauss import gaussian_blur
from sobel import edge_detector
from laplacian import sharpening

parser = argparse.ArgumentParser()
parser.add_argument('--blur', action='store_true')
parser.add_argument('--edge', action='store_true')
parser.add_argument('--sharp', action='store_true')
parser.add_argument("input_file", help="The input image file.")
parser.add_argument("output_file", help="The output image file.")
args = parser.parse_args()

img = imageIO.readImage(args.input_file)
if img is not None:
    startTime = time.time()
    log.status("proccessing image")
    if args.blur:
        blurImage = gaussian_blur(img)
        imageIO.writeImage(blurImage, args.output_file)
    elif args.edge:
        edgeImage = edge_detector(img)
        imageIO.writeImage(edgeImage, args.output_file)
    elif args.sharp:
        sharpImage = sharpening(img)
        imageIO.writeImage(sharpImage, args.output_file)
Exemple #3
0
        Display an image using an image viewer run in a separate thread.

        The environment variable MED_BV_VIEWER_COMMAND specifies the
        location of the itksnap command used for image display.
        
        @param greyImage Either an image file name or an itk image instance.
        @param segmentationImage Either an image file name or an itk image 
            instance corresponding to the segmentation result. Default: None.
        @param comment Comment to be incorporated in temporary file name.
        @param viewerCommand Full path to image viewer command.
            Default: '/GB/itksnap/bin/itksnap'
    """
    #
    # create and start thread executing the __viewImage function
    myThread = threading.Thread(target=__viewImage,
        args= (greyImage, segmentationImage, comment, viewerCommand))
    myThread.start()

if __name__ == '__main__':
    greyImName = os.path.join('MRI_crop', 'MRIcrop-grey_orig.mhd')
    segmentationImName = os.path.join('MRI_crop', 'MRIcrop-seg_orig.mhd')
    viewImage(greyImName, segmentationImage=segmentationImName, 
        comment='ReadFromFile')
    greyIm = imageIO.readImage(greyImName)
    segmentationIm = imageIO.readImage(segmentationImName)
    viewImage(greyIm, segmentationImage=segmentationIm, 
        comment='ConvertedFromImageReferences')
    metaViewer = os.path.join(os.path.sep, 'GB', 'itk', 'bin', 'ImageViewer')
    if os.path.isfile(metaViewer):
        viewImage(greyIm, comment='AlternativeViewer', viewerCommand=metaViewer)