Exemplo n.º 1
0
    img, modality = loadZipDicom( fname[0] )


else:
    if dirFlag:
        if verbose:
            print "directory"
        img, modality = dicomutils.loadLargestSeries( fname[0] )

    else:
        # Case for a single volume image
        if len(fname) == 1:
            if verbose:
                print "Reading volume: ", fname[0]
            img = sitk.ReadImage( fname[0] )
            modality = dicomutils.getModality(img)

        else:
        # Case for a series of image files
            if verbose:
                if verbose>1:
                    print "Reading images: ", fname
                else:
                    l = len(fname)
                    print "Reading images: ", fname[0], fname[1], "...", fname[l-1]
            isr = sitk.ImageSeriesReader()
            isr.SetFileNames(fname)
            img = isr.Execute()
            firstslice = sitk.ReadImage( fname[0] )
            modality = dicomutils.getModality(firstslice)
Exemplo n.º 2
0
    img, modality = loadZipDicom( fname[0] )


else:
    if dirFlag:
        if verbose:
            print "directory"
        img, modality = dicomutils.loadLargestSeries( fname[0] )

    else:
        # Case for a single volume image
        if len(fname) == 1:
            if verbose:
                print "Reading volume: ", fname[0]
            img = sitk.ReadImage( fname[0] )
            modality = dicomutils.getModality(img)

        else:
        # Case for a series of image files
            if verbose:
                if verbose>1:
                    print "Reading images: ", fname
                else:
                    l = len(fname)
                    print "Reading images: ", fname[0], fname[1], "...", fname[l-1]
            isr = sitk.ImageSeriesReader()
            isr.SetFileNames(fname)
            img = isr.Execute()
            firstslice = sitk.ReadImage( fname[0] )
            modality = dicomutils.getModality(firstslice)