Ejemplo n.º 1
0
def readBsqToObj(path,mPath):
    dCube = dataCube()
    (dCube.HSData, dCube.Lambdas) = BSQ.readbsq(dir)
    #add in line to read in mask image
    return dCube
Ejemplo n.º 2
0
def readMaskToObj(dir,maskList):
    dCube = dataCube()
    dCube.MaskData = Image.open(r'MaskPath')
    return dCube
Ejemplo n.º 3
0
    print(sDir)

    #This loop runs when looking in Mask Directory
    if dirs == 'masks':
        for i in range(0,maskCount):
            # dir = os.path.dirname(os.path.join(sDir,objNames[]))
            mFile = os.path.join(sDir, maskNames[i])
            mDir = os.path.dirname(mFile)
            print(mFile[:-4] + '\r\n' + mDir)
            im = np.rot90(TIFFfile.imread(mFile), 2)
            im = im[:,:,0]
            im[im < np.max(im)] = 0
            im[im == np.max(im)] = 1
            scipy.misc.imsave(pathName + '\\processed_masks\\' + maskNames[i][2:-8] + '.png', im)
            # im = skimage.io.imread(mFile, plugin='tifffile')
            A = dataCube(maskNames[i][2:-8], None, None, im)
            print(A.MaskData.shape)
            maskList.append(A)

    ## insert for loop here  (add if statement)
    #This loop runs when looking in BSQ Directory
    if dirs == 'bsq':
        for i in range(0,bsqCount):
            dir = os.path.dirname(os.path.join(sDir,objNames[i]))
            print(str(maskCount))
            if not os.path.exists(dir+'/TIF/'):
                os.mkdir(dir+'/TIF/')
            #outfile = dir + '/TIF/' + os.path.basename(os.path.join(sDir,objNames[i]))[:-4]
            (dcb, lambdas) = BSQ.readbsq(os.path.join(sDir,objNames[i]))

            #print('dcb.shape=', dcb.shape)