Ejemplo n.º 1
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));
Ejemplo n.º 2
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)
from ClearMap.ImageProcessing.Filter.DoGFilter import filterDoG
dataDoG = filterDoG(dataBGR, size=(8, 8, 4), verbose=True)
from ClearMap.ImageProcessing.MaximaDetection import findExtendedMaxima
dataMax = findExtendedMaxima(dataDoG, hMax=None, verbose=True, threshold=10)
from ClearMap.ImageProcessing.MaximaDetection import findCenterOfMaxima
cells = findCenterOfMaxima(data, dataMax)
from ClearMap.ImageProcessing.CellSizeDetection import detectCellShape
dataShape = detectCellShape(dataDoG, cells, threshold=15)
plt.plotOverlayLabel(dataDoG / dataDoG.max(), dataShape, z=(10, 16))
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)

pointSource = os.path.join(BaseDirectory, FilteredCellsFile[0])
data_write = plt.overlayPoints(filename,
                               dataBGR_write,
Ejemplo n.º 4
0
    points_fn = os.path.join(resultDir, 'Points.npy')
    tPointsFN = os.path.join(resultDir, 'Transformed_Points.npy')

    transformFN = os.path.join(transformDir, 'outputpoints.txt')
    tableFN = os.path.join(resultDir, 'ResultsTable.csv')

    #Atlas and Annotation
    transformParameterFN = os.path.join(alignDir, 'TransformParameters.1.txt')

    print(cfos_fn)
    img = io.readData(cfos_fn)
    img = img[..., numpy.newaxis]
    img = img.astype('int16')
    # converting data to smaller integer types can be more memory efficient!

    imgB = bgr.removeBackground(img, size=backgroundSize, verbose=True)
    io.writeData(os.path.join(resultDir, fName + '_BackgroundRemoval.tif'),
                 imgB)

    ##image filter
    imgD = filterDoG(img, size=DoGSize, verbose=True)
    io.writeData(os.path.join(resultDir, fName + '_FilterDoG.tif'), imgD)

    #Detect Maxima
    imgMaxima = findExtendedMaxima(img,
                                   hMax=None,
                                   verbose=True,
                                   threshold=maximaThresh)
    points = findCenterOfMaxima(img, imgMaxima, verbose=True)
    points = points.astype('int16')
Ejemplo n.º 5
0
transformFN = os.path.join(transformResultDir, 'outputpoints.txt')
tableFN = os.path.join(homeDir, 'ResultsTable.csv')

atlasDir = os.path.join('/media/sf_Fred_Data/testClearMap/',
                        orientation + 'Atlas')
annoDir = os.path.join('/media/sf_Fred_Data/testClearMap/',
                       orientation + 'Annotation')
transformParameterFN = os.path.join(alignResultDir,
                                    'TransformParameters.1.txt')

img = io.readData(input_fn)
img = img[..., numpy.newaxis]
img = img.astype('int16')
# converting data to smaller integer types can be more memory efficient!

imgB = bgr.removeBackground(img, size=(8, 8), verbose=True)
io.writeData(os.path.join(homeDir, 'Results/BackgroundRemoval.tif'), imgB)

#image filter
imgD = filterDoG(imgB, size=(15, 15, 1), verbose=True)
io.writeData(os.path.join(homeDir, 'Results/FilterDoG.tif'), imgD)

#Detect Maxima
imgMaxima = findExtendedMaxima(imgD, hMax=None, verbose=True, threshold=3)
points = findCenterOfMaxima(img, imgMaxima)
points = points.astype('int16')

#threshold intensities
dataShape = detectCellShape(imgD, points, threshold=5)
cellSizesPre = findCellSize(dataShape, maxlabel=points.shape[0])
io.writeData(os.path.join(homeDir, 'Results/CellShapes.tif'),