Esempio n. 1
0
def show_files(filelist, sleeptime=.6):
    '''given a list of files, it shows all those images (Doesn't yet
    work for color images'''

    plt.figure()
    loadtimelist = []
    if type(filelist) is not list:
        filelist = [filelist]
    for i in xrange(len(filelist)):
        fname = filelist[i]
        t = time.time()
        name = fname[fname.rfind('/'):fname.rfind('.')]
        Im = cc.LoadTIFF(fname, ca.MEM_HOST)
        print name, i
        cd.DispImage(Im, newFig=False, title=name)
        p = Popen(['xsel', '-pi'], stdin=PIPE)
        p.communicate(input="'" + name + ".png'" + ',\n')
        loadtime = time.time() - t
        loadtimelist.append(loadtime)
        time.sleep(sleeptime)
Esempio n. 2
0
    # mType=ca.MEM_HOST
    mType = ca.MEM_DEVICE
    ds = 2
else:
    mType = ca.MEM_DEVICE
    ds = 1

plt.close('all')

# Rigid Reg parameters
theta_step = 0
t_step = 300
a_step = 0
maxIter = 2000

Imprev = cc.LoadTIFF(filelist[0], mType, ds)
origin = [(Imprev.grid().size().x+1)/2.0, # origin for Affine matrix
          (Imprev.grid().size().y+1)/2.0,
          (Imprev.grid().size().z+1)/2.0]
scratchI = ca.Image3D(Imprev.grid(), Imprev.memType())
scratchI2 = ca.Image3D(Imprev.grid(), Imprev.memType())

# initialize dictionary
Adict = {'origin': origin}
Adict[files.get_file_dist(filelist[0])] = np.identity(3)

# if 'block1' in filelist[0]:
# move first image in block 1
if block == 1:
    tcentx, tcenty = cc.CenterImage(Imprev)
    ca.Copy(scratchI, Imprev)
Esempio n. 3
0
plt.ion()
plt.close('all')
import PyCA.Common as common
from PyCAApps import ElastReg
import matplotlib.mlab as mlab
import scipy
import matplotlib.patches as patches

memT = ca.MEM_DEVICE

conDir = '/local/blakez/Backup/M13_01/data/microscopy/confocal/M13_01_B2_43_S5/zslice_tiles_00/C02/'

#micDir = '/local/blakez/korenbergNAS/3D_database/Raw/Microscopic/Confocal/M13/M13-01-B2-10-S3/2016_10_13_17_45_10--M13-01-B2-10-S3 5x tiling/'
#micOut = '/home/sci/blakez/M13_01/results/microscopic/intensityCorrected/test/'

image = cc.LoadTIFF(conDir + 'M13-01-B2-43-S5-C2_Z0_tile_000.tif', memT)

stack = np.zeros((512, 512, 420), dtype='uint8')

for ii in range(0, 420):
    image = plt.imread(
        conDir +
        'M13-01-B2-43-S5-C2_Z0_tile_{0}.tif'.format(str(int(ii)).zfill(3)),
        memT)
    stack[:, :, ii] = image

fMask = (
    stack > 1
)  # Can Adjust what is considered background by changing the comparison number
f = stack * fMask
m = np.sum(f, axis=2, dtype='float') / np.sum(fMask, axis=2, dtype='float')