#moving and reference images
parameter.Alignment.MovingImage = os.path.join(basedirectory, 'Synthetic/test_iDISCO_resample.tif');
parameter.Alignment.FixedImage  = os.path.join(basedirectory, 'Synthetic/test_iDISCO_reference.tif');
parameter.Alignment.FixedImageMask = None;
  
#elastix parameter files for alignment
parameter.Alignment.AffineParameterFile  = os.path.join(parameter.Alignment.AlignmentDirectory, 'ElastixParameterAffine.txt');
#parameter.Alignment.BSplineParameterFile = os.path.join(parameter.Alignment.AlignmentDirectory, 'ElastixParameterBSpline.txt');
parameter.Alignment.BSplineParameterFile = None;

runInitializeElastix(parameter)

runCellCoordinateTransformationToReference(parameter)

if verbose:
    refdata = io.readData(parameter.Alignment.FixedImage);
    pts = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
    Plot.plotOverlayPoints(0.01 * refdata, pts)




##############################################################################
# Test Voxelization
##############################################################################

import os

from iDISCO.Parameter import *
from iDISCO.Run import runVoxelization
Example #2
0
parameter.DataSource.ImageFile = os.path.join(
    basedirectory,
    'Test/Data/OME/16-17-27_0_8X-s3-20HF_UltraII_C00_xyz-Table Z\d{4}.ome.tif')

parameter.DataSource.ImageFile = '/run/media/ckirst/ChristophsBackuk4TB/Data/Science/Projects/BrainActiityMap/Experiment/iDISCO_2015_06/Adult cfos C row 20HF 150524.ims'

#image ranges
parameter.DataSource.XRange = all
parameter.DataSource.YRange = all
parameter.DataSource.ZRange = (100, 120)

# load data

data = io.readData(parameter.DataSource.ImageFile,
                   x=parameter.DataSource.XRange,
                   y=parameter.DataSource.YRange,
                   z=parameter.DataSource.ZRange,
                   resolution=0)
print "Loaded data from " + parameter.DataSource.ImageFile
print "Data size is: " + str(data.shape)

# visualize

if verbose:
    plt.plotTiling(15 * data)

### Process using Spot Detection

# radius for background removal
parameter.ImageProcessing.Parameter.Background = (15, 15)
#parameter.Alignment.BSplineParameterFile = None;

runInitializeElastix(parameter)

#pts = io.readPoints(parameter.ImageProcessing.CellCoordinateFile);
#pts = pts[0:10000, :];
#pts[0,:] = [0,0,0];
#pts = pts[:, [1,0,2]];

runCellCoordinateTransformationToReference(parameter)

#pts2 = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
#pts2 = pts2[:,[1,0,2]];

if verbose:
    refdata = io.readData(parameter.Alignment.FixedImage)
    #pts = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
    Plot.plotOverlayPoints(0.1 * refdata, pts2)

refdata.shape

pts2 = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile)
#pts2 = pts2[:,[1,0,2]];
voximg = vox.voxelizePixel(pts2, refdata.shape)
io.writeDataStack(os.path.join(basedirectory, 'points_transformed_pixel.tif'),
                  voximg)

##############################################################################
# Test Resample Points
##############################################################################
runInitializeElastix(parameter)


#pts = io.readPoints(parameter.ImageProcessing.CellCoordinateFile);
#pts = pts[0:10000, :];
#pts[0,:] = [0,0,0];
#pts = pts[:, [1,0,2]];

runCellCoordinateTransformationToReference(parameter)

#pts2 = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
#pts2 = pts2[:,[1,0,2]];


if verbose:
    refdata = io.readData(parameter.Alignment.FixedImage);
    #pts = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
    Plot.plotOverlayPoints(0.1 * refdata, pts2)


refdata.shape

pts2 = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
#pts2 = pts2[:,[1,0,2]];
voximg = vox.voxelizePixel(pts2, refdata.shape);
io.writeDataStack(os.path.join(basedirectory, 'points_transformed_pixel.tif'), voximg)




    };



allParameter = joinParameter(stackProcessingParameter, spotDetectionParameter, {'x' : (100,160), 'y' : (10,140), 'z' : (2,38)})
#allParameter = joinParameter(stackProcessingParameter, spotDetectionParameter, {'x' : all, 'y' : all, 'z' : all})

result = detectCells(**allParameter);
print(result)

verbose = True;
if verbose:
    import iDISCO.IO.IO as io
    import iDISCO.Visualization.Plot as plot   
    
    dataraw = io.readData(spotDetectionParameter["source"]);
    dataraw[dataraw > 50] = 50;
    dataraw = dataraw.astype('float') / dataraw.max();
    points  = io.readPoints(spotDetectionParameter["sink"][0]);
    plot.plotOverlayPoints(dataraw, points, pointColor = [1,0,0]);


dataraw = io.readData(spotDetectionParameter["source"], x = (100,160), y = (10,140), z =  (2,38));
io.writeData( os.path.join(baseDirectory, 'Synthetic/raw.tif'), dataraw)

##############################################################################
# Test Resample Points
############################################################################## 

import os
Example #6
0
#moving and reference images
parameter.Alignment.MovingImage = os.path.join(basedirectory, 'Synthetic/test_iDISCO_resample.tif');
parameter.Alignment.FixedImage  = os.path.join(basedirectory, 'Synthetic/test_iDISCO_reference.tif');
parameter.Alignment.FixedImageMask = None;
  
#elastix parameter files for alignment
parameter.Alignment.AffineParameterFile  = os.path.join(parameter.Alignment.AlignmentDirectory, 'ElastixParameterAffine.txt');
#parameter.Alignment.BSplineParameterFile = os.path.join(parameter.Alignment.AlignmentDirectory, 'ElastixParameterBSpline.txt');
parameter.Alignment.BSplineParameterFile = None;

runInitializeElastix(parameter)

runCellCoordinateTransformationToReference(parameter)

if verbose:
    refdata = io.readData(parameter.Alignment.FixedImage);
    pts = io.readPoints(parameter.ImageProcessing.CellTransformedCoordinateFile);
    Plot.plotOverlayPoints(0.01 * refdata, pts)




##############################################################################
# Test Voxelization
##############################################################################

import os

from iDISCO.Parameter import *
from iDISCO.Run import runVoxelization
    };



allParameter = joinParameter(stackProcessingParameter, spotDetectionParameter, {'x' : (100,160), 'y' : (10,140), 'z' : (2,38)})
#allParameter = joinParameter(stackProcessingParameter, spotDetectionParameter, {'x' : all, 'y' : all, 'z' : all})

result = detectCells(**allParameter);
print result

verbose = True;
if verbose:
    import iDISCO.IO.IO as io
    import iDISCO.Visualization.Plot as plot   
    
    dataraw = io.readData(spotDetectionParameter["source"]);
    dataraw[dataraw > 50] = 50;
    dataraw = dataraw.astype('float') / dataraw.max();
    points  = io.readPoints(spotDetectionParameter["sink"][0]);
    plot.plotOverlayPoints(dataraw, points, pointColor = [1,0,0]);


dataraw = io.readData(spotDetectionParameter["source"], x = (100,160), y = (10,140), z =  (2,38));
io.writeData( os.path.join(baseDirectory, 'Synthetic/raw.tif'), dataraw)

##############################################################################
# Test Resample Points
############################################################################## 

import os
Example #8
0
### Data Source 

#raw data from microscope used for cell detection (ims or tif)
parameter.DataSource.ImageFile = os.path.join(basedirectory, 'Test/Data/OME/16-17-27_0_8X-s3-20HF_UltraII_C00_xyz-Table Z\d{4}.ome.tif')

parameter.DataSource.ImageFile = '/run/media/ckirst/ChristophsBackuk4TB/Data/Science/Projects/BrainActiityMap/Experiment/iDISCO_2015_06/Adult cfos C row 20HF 150524.ims'

#image ranges
parameter.DataSource.XRange = all;
parameter.DataSource.YRange = all;
parameter.DataSource.ZRange = (100,120);

# load data

data = io.readData(parameter.DataSource.ImageFile, x = parameter.DataSource.XRange, y = parameter.DataSource.YRange, z = parameter.DataSource.ZRange, resolution = 0);
print "Loaded data from " + parameter.DataSource.ImageFile;
print "Data size is: " + str(data.shape)

# visualize

if verbose:
    plt.plotTiling(15*data)


### Process using Spot Detection

# radius for background removal
parameter.ImageProcessing.Parameter.Background = (15,15);

img = ip.removeBackground(data, parameter = parameter.ImageProcessing, verbose =  verbose);