Ejemplo n.º 1
0
def runVoxelization(parameter):
    """Voxelize a set of points"""

    cf = parameter.ImageProcessing.CellTransformedCoordinateFile
    if cf is None:
        cf = parameter.ImageProcessing.CellCoordinateFile

    points = io.readPoints(cf)

    pv = parameter.Voxelization

    si = pv.Size
    if si is None:
        si = parameter.Alignment.MovingImage
        if si is None:
            si = parameter.Resampling.ResampledFile

    if isinstance(si, str):
        si = dataSize(si)

    print(si)

    vox = voxelize(points, si, average=pv.AveragingDiameter, mode=pv.Mode)

    vf = pv.File
    if vf is None:
        return vox
    else:
        io.writeDataStack(vf, vox.astype('int32'))
        return vf
Ejemplo n.º 2
0
def runVoxelization(parameter):
    """Voxelize a set of points"""
    
    cf = parameter.ImageProcessing.CellTransformedCoordinateFile;
    if cf is None:
        cf =  parameter.ImageProcessing.CellCoordinateFile;
    
    points = io.readPoints(cf);
    
    pv = parameter.Voxelization;

    si = pv.Size;
    if si is None:
        si = parameter.Alignment.MovingImage;
        if si is None:    
            si = parameter.Resampling.ResampledFile;
            
    if isinstance(si, basestring):
        si = dataSize(si);
        
    print si

    vox = voxelize(points, si, average = pv.AveragingDiameter, mode = pv.Mode);
    
    vf = pv.File;
    if vf is None:
        return vox;
    else:
        io.writeDataStack(vf, vox.astype('int32'));
        return vf;
#parameter.Alignment.BSplineParameterFile = os.path.join(parameter.Alignment.AlignmentDirectory, 'ElastixParameterBSpline.txt');#
#parameter.Alignment.BSplineParameterFile = None;

runInitializeElastix(parameter)

pts = runCellCoordinateTransformation(parameter)

io.writePoints(os.path.join(basedirectory, 'cells_to_autofluo.csv'), pts)

## Visualize cfos to auto points
parameter.ImageProcessing.CellCoordinateFile = pts
parameter.ImageProcessing.CellTransformedCoordinateFile = None

pts2 = runCellCoordinateResampling(parameter)

ds = dataSize(os.path.join(basedirectory, 'autofluo_for_cfos_resample.tif'))

voximg = vox.voxelizePixel(pts2, ds)
io.writeDataStack(
    os.path.join(basedirectory, 'points_transformed_cfos_to_auto.tif'), voximg)

#pts0 = io.readPoints(os.path.join(basedirectory, 'cells.csv'));

##############################################################################
# Transform Points matched to Autofluorescence to Atlas Reference
##############################################################################

import os

from iDISCO.Parameter import *
from iDISCO.Run import runInitializeElastix, runCellCoordinateTransformationToReference
Ejemplo n.º 4
0
#parameter.Alignment.BSplineParameterFile = None;

runInitializeElastix(parameter);

pts = runCellCoordinateTransformation(parameter);

io.writePoints(os.path.join(basedirectory, 'cells_to_autofluo.csv'), pts);


## Visualize cfos to auto points
parameter.ImageProcessing.CellCoordinateFile = pts;
parameter.ImageProcessing.CellTransformedCoordinateFile = None;

pts2 = runCellCoordinateResampling(parameter)

ds = dataSize(os.path.join(basedirectory, 'autofluo_for_cfos_resample.tif'));

voximg = vox.voxelizePixel(pts2, ds);
io.writeDataStack(os.path.join(basedirectory, 'points_transformed_cfos_to_auto.tif'), voximg)

#pts0 = io.readPoints(os.path.join(basedirectory, 'cells.csv'));


##############################################################################
# Transform Points matched to Autofluorescence to Atlas Reference
############################################################################## 

import os

from iDISCO.Parameter import *
from iDISCO.Run import runInitializeElastix, runCellCoordinateTransformationToReference