Esempio n. 1
0
def test():
    """Test voxelization module"""
    import ClearMap.Analysis.Voxelization as self
    reload(self)

    import ClearMap.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 ClearMap.Visualization.Plot as Plot

    Plot.plotTiling(vi)

    #use voxelize
    vi = self.voxelize(points, dataSize = (20,20,20), size = (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), size = (5,5,5));
    viw =  self.voxelize(points, dataSize = (20,20,20), size = (5,5,5), weights = weights);

    Plot.plotTiling(vi)
    Plot.plotTiling(viw)
Esempio n. 2
0
def plotImportPreview(importResult):
  """Plots the prestiched preview file to check orientations and coarse alignment
  
  Arguments:
    importResult (str): the base directory of the image data or the import xml file
  
  Returns:
    object: plot axes
  """
  return cplt.plotTiling(readImportPreview(importResult));
def plotImportPreview(importResult):
    """Plots the prestiched preview file to check orientations and coarse alignment
  
  Arguments:
    importResult (str): the base directory of the image data or the import xml file
  
  Returns:
    object: plot axes
  """
    return cplt.plotTiling(readImportPreview(importResult))
Esempio n. 4
0
def test():
    """Test the statistics array"""
    import ClearMap.Analysis.Statistics as self
    reload(self)
    import numpy, os
    import matplotlib.pyplot as plt
    #x = stats.norm.rvs(loc=5,scale=1,size=1500)
    #y = stats.norm.rvs(loc=-5,scale=1,size=1500)
    s = numpy.ones((5, 4, 20))
    s[:, 0:3, :] = -1

    x = numpy.random.rand(4, 4, 20)
    y = numpy.random.rand(5, 4, 20) + s

    # print stats.ttest_ind(x,y, axis = 0, equal_var = False);
    pvals, psign = self.tTestVoxelization(x, y, signed=True)
    print pvals

    pvalscol = self.colorPValues(pvals,
                                 psign,
                                 positive=[255, 0, 0],
                                 negative=[0, 255, 0])

    import ClearMap.Visualization.Plot as plt_cm
    plot = plt_cm.plotTiling(pvalscol)
    plt.show()

    # test points
    basedir = '/home/vzickus/repos/ClearMap-Debug/ClearMap'
    import ClearMap.Settings as settings
    pf = os.path.join(basedir,
                      'Test/Synthetic/cells_transformed_to_reference.csv')
    pf = numpy.loadtxt(pf, delimiter=',')
    pg = (pf, pf)

    pc = self.countPointsGroupInRegions(pg)

    pvals, tvals = self.tTestPointsInRegions(pg, pg, signed=True)
Esempio n. 5
0
import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif');
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z = (0,26));
import ClearMap.ImageProcessing.BackgroundRemoval as bgr
dataBGR = bgr.removeBackground(data.astype('float'), size=(3,3), verbose = True);
plt.plotTiling(dataBGR, inverse = True, z = (10,16));
Esempio n. 6
0
import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath,
                        'Test/Data/ImageAnalysis/cfos-substack.tif')
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z=(0, 26))
plt.plotTiling(data, x=(0, 70), y=(0, 50), z=(10, 16))
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 19 04:29:29 2015

@author: ckirst
"""

import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath,
                        'Test/Data/ImageAnalysis/cfos-substack.tif')
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z=(0, 30))
plt.plotTiling(data, inverse=True, z=(10, 16))

#import ClearMap.ImageProcessing.ImageStatistics as stat
#stat.calculateStatistics(filename, method = 'mean', verbose = True)

import ClearMap.ImageProcessing.BackgroundRemoval as bgr

dataBGR = bgr.removeBackground(data.astype('float'),
                               size=(10, 10),
                               verbose=True)
plt.plotTiling(dataBGR, inverse=True, z=(10, 16))

from ClearMap.ImageProcessing.Filter.DoGFilter import filterDoG
dataDoG = filterDoG(dataBGR, size=(8, 8, 4), verbose=True)
plt.plotTiling(dataDoG, inverse=True, z=(10, 16))

import os
Esempio n. 8
0
import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif');
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z = (0,26));
plt.plotTiling(data, x= (0,70), y = (0,50), z = (10,16));
import ClearMap.Settings as settings
import ClearMap.Visualization.Plot as plt
import ClearMap.ImageProcessing.BackgroundRemoval as bgr
import matplotlib as mplt

BaseDirectory = '/d2/studies/ClearMap/IA_iDISCO/IA1_RB/'
filename = os.path.join(BaseDirectory, 'IA1_RB_cfos_stack.ome.tif')

data = io.readData(filename, z=(600, 650))
# size restriction
fileRange = 'x = (1050, 1350), y = (550,850), z = (25,34)'
""" note that the Z coordinate in fileRange variable are relative to the planes imported in the data variable.
So in this case, you would be imaging planes 675-684.
"""

plt.plotTiling(data, inverse=True, x=(1250, 1350), y=(550, 650), z=(25, 34))  #
# background subtraction
dataBGR = bgr.removeBackground(data.astype('float'),
                               size=(5, 5),
                               verbose=False,
                               save=None)
dataBGR_write = plt.plotTiling(dataBGR,
                               inverse=True,
                               x=(1250, 1350),
                               y=(550, 650),
                               z=(25, 34))
dataBGR_write = plt.overlayPoints(dataBGR, fileRange)
mplt.pyplot.savefig(os.path.join(BaseDirectory, 'dataBGR_write.tif'))

io.writeData(os.path.join(BaseDirectory, 'background_8.tif'), dataBGR_write)
io.writeData(os.path.join(BaseDirectory, 'cells_check.tif'), data)
Esempio n. 10
0
import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif');
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z = (0,26));
plt.plotTiling(data);