コード例 #1
0
ファイル: Voxelization.py プロジェクト: mgxd/ClearMap
def test():
    """Test voxelization module"""
    
    import iDISCO.Analysis.Voxelization as self
    reload(self)
    
    import iDISCO.Analysis.VoxelizationCode as vox
    import numpy
    
    
    points = numpy.random.rand(200,3) * 10;
    
    #use cython code
    vi = vox.voxelizeSphere(points, 20,20,20, 5,5,5);
    
    import iDISCO.Visualization.Plot as Plot

    Plot.plotTiling(vi)
    
    #use voxelize
    vi = self.voxelize(points, dataSize = (20,20,20), average = (5,5,5));
    
    Plot.plotTiling(vi)
    
    
    #weighted voxelization 
    points = numpy.random.rand(10,3) * 10;    
    weights = numpy.random.rand(10);
    
    #use voxelize
    vi = self.voxelize(points, dataSize = (20,20,20), average = (5,5,5));
    viw =  self.voxelize(points, dataSize = (20,20,20), average = (5,5,5), weights = weights);
    
    Plot.plotTiling(vi)
    Plot.plotTiling(viw)
コード例 #2
0
ファイル: FileList.py プロジェクト: fshen11/fredClearMap
def test():
    """Test FileList module"""
    import ClearMap.IO.FileList as self
    reload(self)

    from iDISCO.Parameter import iDISCOPath
    import os
    import numpy

    basedir = iDISCOPath()
    fn = os.path.join(basedir, 'Test/Data/FileList/test\d{4}.tif')

    data = numpy.random.rand(20, 50, 10)
    data[5:15, 20:45, 2:9] = 0
    data = 20 * data
    data = data.astype('int32')

    print "writing raw image to: " + fn
    self.writeData(fn, data)

    print "Loading raw image from: " + fn
    img = self.readData(fn)
    print "Image size: " + str(img.shape)

    diff = img - data
    print(diff.max(), diff.min())

    fn = os.path.join(
        basedir,
        'Test/Data/OME/16-17-27_0_8X-s3-20HF_UltraII_C00_xyz-Table Z\d{4}.ome.tif'
    )

    fp, fl = self.readFileList(fn)
    print "Found " + str(len(fl)) + " images!"

    #dataSize
    print "dataSize  is %s" % str(self.dataSize(fn))
    print "dataZSize is %s" % str(self.dataZSize(fn))

    print "dataSize  is %s" % str(self.dataSize(fn, x=(10, 20)))
    print "dataZSize is %s" % str(self.dataZSize(fn))

    img = self.readData(fn, z=(17, all))
    print "Image size: " + str(img.shape)

    import iDISCO.Visualization.Plot as plt
    plt.plotTiling(img)
コード例 #3
0
def test():
    """Test FileList module"""
    import ClearMap.IO.FileList as self

    reload(self)

    from iDISCO.Parameter import iDISCOPath
    import os
    import numpy

    basedir = iDISCOPath()
    fn = os.path.join(basedir, "Test/Data/FileList/test\d{4}.tif")

    data = numpy.random.rand(20, 50, 10)
    data[5:15, 20:45, 2:9] = 0
    data = 20 * data
    data = data.astype("int32")

    print "writing raw image to: " + fn
    self.writeData(fn, data)

    print "Loading raw image from: " + fn
    img = self.readData(fn)
    print "Image size: " + str(img.shape)

    diff = img - data
    print (diff.max(), diff.min())

    fn = os.path.join(basedir, "Test/Data/OME/16-17-27_0_8X-s3-20HF_UltraII_C00_xyz-Table Z\d{4}.ome.tif")

    fp, fl = self.readFileList(fn)
    print "Found " + str(len(fl)) + " images!"

    # dataSize
    print "dataSize  is %s" % str(self.dataSize(fn))
    print "dataZSize is %s" % str(self.dataZSize(fn))

    print "dataSize  is %s" % str(self.dataSize(fn, x=(10, 20)))
    print "dataZSize is %s" % str(self.dataZSize(fn))

    img = self.readData(fn, z=(17, all))
    print "Image size: " + str(img.shape)

    import iDISCO.Visualization.Plot as plt

    plt.plotTiling(img)
コード例 #4
0
ファイル: Voxelization.py プロジェクト: fshen11/fredClearMap
def test():
    """Test voxelization module"""

    import iDISCO.Analysis.Voxelization as self
    reload(self)

    import iDISCO.Analysis.VoxelizationCode as vox
    import numpy

    points = numpy.random.rand(200, 3) * 10

    #use cython code
    vi = vox.voxelizeSphere(points, 20, 20, 20, 5, 5, 5)

    import iDISCO.Visualization.Plot as Plot

    Plot.plotTiling(vi)

    #use voxelize
    vi = self.voxelize(points, dataSize=(20, 20, 20), average=(5, 5, 5))

    Plot.plotTiling(vi)

    #weighted voxelization
    points = numpy.random.rand(10, 3) * 10
    weights = numpy.random.rand(10)

    #use voxelize
    vi = self.voxelize(points, dataSize=(20, 20, 20), average=(5, 5, 5))
    viw = self.voxelize(points,
                        dataSize=(20, 20, 20),
                        average=(5, 5, 5),
                        weights=weights)

    Plot.plotTiling(vi)
    Plot.plotTiling(viw)
コード例 #5
0
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)
print img.dtype
print img.shape

# size of differeence of gaussian filter
parameter.ImageProcessing.Parameter.Dog = (7, 7, 11)
コード例 #6
0
resultDirectory = os.path.join(baseDirectory, 'Synthetic/transformix')

#elx.transformData(dataresname, alignmentdirectory = resultdir, outdirectory = dataalgname)
resultFile = elx.transformData(referenceFile, transformDirectory = transformDirectory, resultDirectory = resultDirectory)

if verbose:
    resampledata  = io.readData(resampleFile);
    referencedata = io.readData(referenceFile);
    transformdata = io.readData(resultFile);

    print(resampledata.shape)
    print(referencedata.shape)
    print(transformdata.shape)

    plot.plotTiling(0.01 * resampledata)
    plot.plotTiling(0.01 * referencedata)
    plot.plotTiling(0.01 * transformdata)    



##############################################################################
# Transform Points from Raw Data to Reference
############################################################################## 

import os

import iDISCO.Settings as settings
import iDISCO.Visualization.Plot as plot
import iDISCO.IO.IO as io
コード例 #7
0
resultDirectory = os.path.join(baseDirectory, 'Synthetic/transformix')

#elx.transformData(dataresname, alignmentdirectory = resultdir, outdirectory = dataalgname)
resultFile = elx.transformData(referenceFile, transformDirectory = transformDirectory, resultDirectory = resultDirectory)

if verbose:
    resampledata  = io.readData(resampleFile);
    referencedata = io.readData(referenceFile);
    transformdata = io.readData(resultFile);

    print resampledata.shape
    print referencedata.shape
    print transformdata.shape    

    plot.plotTiling(0.01 * resampledata)
    plot.plotTiling(0.01 * referencedata)
    plot.plotTiling(0.01 * transformdata)    



##############################################################################
# Transform Points from Raw Data to Reference
############################################################################## 

import os

import iDISCO.Settings as settings
import iDISCO.Visualization.Plot as plot
import iDISCO.IO.IO as io
コード例 #8
0
ファイル: test.py プロジェクト: ChristophKirst/ClearMap
#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);
print img.dtype
print img.shape

# size of differeence of gaussian filter
parameter.ImageProcessing.Parameter.Dog = (7, 7, 11);

img = ip.dogFilter(img, parameter = parameter.ImageProcessing, verbose =  verbose);