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 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) plt.plotOverlayLabel(dataDoG / dataDoG.max(), dataMax.astype('int'), z=(10, 16))
dataBGR_write, fileRange, pointColor=None) io.writeData(os.path.join(BaseDirectory, 'cells_check.tif'), data) #DoG Filter from ClearMap.ImageProcessing.Filter.DoGFilter import filterDoG dataDoG = filterDoG(dataBGR, size=(7, 7, 9), verbose=False) plt.plotTiling(dataDoG, inverse=True, x=(600, 700), y=(600, 700), z=(1, 15)) #Find Extended Maxima from ClearMap.ImageProcessing.MaximaDetection import findExtendedMaxima dataMax = findExtendedMaxima(dataDoG, hMax=None, verbose=True, threshold=500) plt.plotOverlayLabel(dataDoG / dataDoG.max(), dataMax.astype('int'), x=(1750, 1850), y=(1050, 1150), z=(1, 9)) #Find Peak Intensity findIntensityParameter = { "method": 'Max', # (str, func, None) method to use to determine intensity (e.g. "Max" or "Mean") if None take intensities at the given pixels "size": ( 7, 7, 5 ) # (tuple) size of the search box on which to perform the *method* } #Cell Shape Parameters detectCellShapeParameter = { "threshold": 500, # (float or None) threshold to determine mask. Pixels below this are background if None no mask is generated
from ClearMap.ImageProcessing.MaximaDetection import findExtendedMaxima dataMax = findExtendedMaxima(dataDoG, hMax = None, verbose = True, threshold = 10); #plt.plotOverlayLabel( dataDoG / dataDoG.max(), dataMax.astype('int'), z = (10,16)) from ClearMap.ImageProcessing.MaximaDetection import findCenterOfMaxima cells = findCenterOfMaxima(data, dataMax); print cells.shape plt.plotOverlayPoints(data, cells, z = (10,16)) from ClearMap.ImageProcessing.CellSizeDetection import detectCellShape dataShape = detectCellShape(dataDoG, cells, threshold = 15); plt.plotOverlayLabel(dataDoG / dataDoG.max(), dataShape, z = (10,16)) # find intensities / cell sizes from ClearMap.ImageProcessing.CellSizeDetection import findCellSize, findCellIntensity #size of cells cellSizes = findCellSize(dataShape, maxLabel = cells.shape[0]); #intensity of cells cellIntensities = findCellIntensity(dataBGR, dataShape, maxLabel = cells.shape[0]); import matplotlib.pyplot as mpl mpl.figure()
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); plt.plotOverlayLabel(dataDoG / dataDoG.max(), dataMax.astype('int'), z = (10,16), x = (50,100), y = (50,100))