Esempio n. 1
0
# Define cone geometry
cylinderHeight = 90.3332804037
coneUpperRadius = 635.3 / 2.
coneLowerRadius = 448.5 / 2.

# Slice
center = [249.00918273645539, 263.82920110192839]
imagingRadius = 216.742098118

#--------------------------------------------------------
# Embryo setup
#--------------------------------------------------------

# Create embryo
emb = pyfrp_embryo.embryo("Test")

# Set experimental details
emb.setDataResMu(dataResMu)
emb.setSliceDepthMu(sliceDepth)
emb.offsetBleachedPx = [
    center[0] - sidelength / 2., center[1] - sidelength / 2.
]

# Geometry
emb.setGeometry2Cone(center, coneUpperRadius, coneLowerRadius, cylinderHeight)

# Update geometry properties in geo-file
emb.geometry.updateGeoFile()

# Create default ROIs
Esempio n. 2
0
# Define cone geometry
cylinderHeight=90.3332804037
coneUpperRadius=635.3/2.
coneLowerRadius=448.5/2.

# Slice
center=[249.00918273645539, 263.82920110192839] 
imagingRadius=216.742098118
 
#--------------------------------------------------------
# Embryo setup
#--------------------------------------------------------

# Create embryo
emb=pyfrp_embryo.embryo("Test")

# Set experimental details
emb.setDataResMu(dataResMu)
emb.setSliceDepthMu(sliceDepth)
emb.offsetBleachedPx=[center[0]-sidelength/2.,center[1]-sidelength/2.]
	
# Geometry
emb.setGeometry2Cone(center,coneUpperRadius,coneLowerRadius,cylinderHeight)
		
# Update geometry properties in geo-file
emb.geometry.updateGeoFile()

# Create default ROIs
emb.genDefaultROIs(emb.geometry.getCenter(),imagingRadius,rimFactor=rimFactor,sliceHeightPx=-sliceDepth)
emb.newAnalysis()
Esempio n. 3
0
volSize = 30

# Add circular domain
d.addCircleByParameters([256, 256],
                        300,
                        0,
                        volSize,
                        genLoop=True,
                        genSurface=True)

# Add attractor mesh around center
v = d.vertices[0]
v.addToAttractor(attrField=None, LcMin=5., LcMax=20., DistMin=30., DistMax=60.)

# Write to file
d.writeToFile(sys.argv[1])

# Create embryo
emb = pyfrp_embryo.embryo("test")

# Set newly generated geofile as geometry
emb.setGeometry2Custom([256, 256], fnGeo=sys.argv[1], dim=2)

# Create mesh
sim = emb.newSimulation()
sim.mesh.genMesh()

# Plot mesh
sim.mesh.plotMesh()

raw_input()
Esempio n. 4
0
sidelength = 140.
sliceDepth = 15.
sliceWidth = 5
center = [256, 256]
rimFactor = 0.8

# Simulation parameters
D = 50
steps = 1001
tEnd = 1500

# Start timer
starTime = time.time()

# Create embryo
emb = pyfrp_embryo.embryo("Demo")

# Define where data is
emb.setDataFolder(sys.argv[1])

# Set data parameters
emb.setDataResMu(dataResMu)
emb.setFrameInterval(frameinterval)

# Set experimental details
emb.setDataResMu(dataResMu)
emb.setSideLengthBleachedMu(sidelength)
emb.setSliceDepthMu(sliceDepth)

# Create a .geo file of a 2 dimensional domain
d = pyfrp_gmsh_geometry.domain()
Esempio n. 5
0
def buildEmbryoWizard(fn,
                      ftype,
                      name,
                      nChannel=0,
                      enc="uint16",
                      fnDest=None,
                      createEmbryo=True,
                      recoverIdent=['recover', 'post'],
                      bleachIdent=['bleach'],
                      preIdent=['pre'],
                      cleanUp=True,
                      colorPrefix='_c00'):
    """Creates embryo object ready for analysis from microscope data.
	
	(1) Extracts microscope data into .tif files
	(2) Builds folder structure
	(3) Moves image files in proper folders
	(4) Creates embryo object and automatically sets filepaths properly
	
	Args:
		fn (str): Path to embryo folder
		ftype (str): Type of microscopy file, such as lsm or czi
		name (str): Name of embryo
	
	Keyword Args:
		nChannel (int): Defines which channel of the images contains relevant data
		fnDest (str): Path of embryo data structure
		createEmbryo (boo): Flag if embryo object should be created
		recoverIdent (list): List of identifiers for recovery data
		bleachIdent (list): List of identifiers for bleach data
		preIdent (list): List of identifiers for pre-bleach data
		cleanUp (bool): Clean up .tif files from other channels afterwards.
	
		
	Returns:
		pyfrp.subclasses.pyfrp_embryo.embryo: Created Embryo in case of success, otherwise -1

	"""

    # Fix path
    fn = slashToFn(fixPath(fn))

    # Make sure that input directory exists
    if not os.path.isdir(fn):
        printError(fn + " does not exist.")
        return -1

    # Get all files of right type
    l = glob.glob(fn + '/*' + ftype)
    if len(l) == 0:
        printError(fn + "does not contain images of type " + ftype)
        return -1

    # Extract images using Bioformats
    for f in l:
        r = pyfrp_img_module.extractBioFormats(f,
                                               fn,
                                               debug=True,
                                               series=0,
                                               channel=nChannel,
                                               enc=enc,
                                               outputformat='tif')
    if r == -1:
        return -1

    # Check for output directory
    if fnDest == None:
        fnDest = fn
    fnDest = slashToFn(fixPath(fnDest))

    # Create folder structure
    makeEmbryoFolderStruct(fnDest)

    # Sort image files in structure
    sortImageFiles(fn,
                   fnDest,
                   ftype,
                   nChannel=nChannel,
                   recoverIdent=recoverIdent,
                   bleachIdent=bleachIdent,
                   preIdent=preIdent,
                   colorPrefix=colorPrefix,
                   cleanUp=cleanUp)

    if createEmbryo:
        from pyfrp.subclasses import pyfrp_embryo

        emb = pyfrp_embryo.embryo(name)
        emb.setDataFolder(fnDest + 'recover/')
        a = emb.newAnalysis()
        a.setFnPre(fnDest + 'pre/')

        return emb
    else:
        return 1
Esempio n. 6
0
from pyfrp.subclasses import pyfrp_embryo
import sys

# Create domain
d = pyfrp_gmsh_geometry.domain()
volSize=30
	
# Add circular domain
d.addCircleByParameters([256,256],300,0,volSize,genLoop=True,genSurface=True)

# Add attractor mesh around center
v=d.vertices[0]
v.addToAttractor(attrField=None,LcMin=5.,LcMax=20.,DistMin=30.,DistMax=60.)

# Write to file
d.writeToFile(sys.argv[1])

# Create embryo
emb=pyfrp_embryo.embryo("test")
		
# Set newly generated geofile as geometry
emb.setGeometry2Custom([256,256],fnGeo=sys.argv[1],dim=2)

# Create mesh
sim=emb.newSimulation()
sim.mesh.genMesh()

# Plot mesh
sim.mesh.plotMesh()

raw_input()
Esempio n. 7
0
def buildEmbryoWizard(fn,ftype,name,nChannel=0,enc="uint16",fnDest=None,createEmbryo=True,recoverIdent=['recover','post'],bleachIdent=['bleach'],preIdent=['pre'],cleanUp=True,colorPrefix='_c00'):
	
	"""Creates embryo object ready for analysis from microscope data.
	
	(1) Extracts microscope data into .tif files
	(2) Builds folder structure
	(3) Moves image files in proper folders
	(4) Creates embryo object and automatically sets filepaths properly
	
	Args:
		fn (str): Path to embryo folder
		ftype (str): Type of microscopy file, such as lsm or czi
		name (str): Name of embryo
	
	Keyword Args:
		nChannel (int): Defines which channel of the images contains relevant data
		fnDest (str): Path of embryo data structure
		createEmbryo (boo): Flag if embryo object should be created
		recoverIdent (list): List of identifiers for recovery data
		bleachIdent (list): List of identifiers for bleach data
		preIdent (list): List of identifiers for pre-bleach data
		cleanUp (bool): Clean up .tif files from other channels afterwards.
	
		
	Returns:
		pyfrp.subclasses.pyfrp_embryo.embryo: Created Embryo in case of success, otherwise -1

	"""
	
	# Fix path
	fn=slashToFn(fixPath(fn))
	
	# Make sure that input directory exists
	if not os.path.isdir(fn):
		printError(fn+ " does not exist.")
		return -1
	
	# Get all files of right type
	l=glob.glob(fn+'/*'+ftype)
	if len(l)==0:
		printError(fn+ "does not contain images of type " + ftype)
		return -1
	
	# Extract images using Bioformats
	for f in l:
		r=pyfrp_img_module.extractBioFormats(f,fn,debug=True,series=0,channel=nChannel,enc=enc,outputformat='tif')
	if r==-1:
		return -1
	
	# Check for output directory
	if fnDest==None:
		fnDest=fn
	fnDest=slashToFn(fixPath(fnDest))
	
	# Create folder structure
	makeEmbryoFolderStruct(fnDest)
	
	
	
	# Sort image files in structure
	sortImageFiles(fn,fnDest,ftype,nChannel=nChannel,recoverIdent=recoverIdent,bleachIdent=bleachIdent,preIdent=preIdent,colorPrefix=colorPrefix,cleanUp=cleanUp)
	
	if createEmbryo:
		from pyfrp.subclasses import pyfrp_embryo
		
		emb=pyfrp_embryo.embryo(name)
		emb.setDataFolder(fnDest+'recover/')
		a=emb.newAnalysis()
		a.setFnPre(fnDest+'pre/')
		
		return emb
	else:
		return 1
Esempio n. 8
0
sidelength=140.
sliceDepth=15.
sliceWidth=5 
center=[256,256]
rimFactor=0.8

# Simulation parameters
D=50
steps=1001
tEnd=1500

# Start timer
starTime=time.time()

# Create embryo
emb=pyfrp_embryo.embryo("Demo")

# Define where data is
emb.setDataFolder(sys.argv[1])




# Set data parameters
emb.setDataResMu(dataResMu)
emb.setFrameInterval(frameinterval)

# Set experimental details
emb.setDataResMu(dataResMu)
emb.setSideLengthBleachedMu(sidelength)
emb.setSliceDepthMu(sliceDepth)