Пример #1
0
def runCellDetection(parameter):
    """Detect cells in data"""

    timer = Timer()

    pp = parameter.StackProcessing
    ps = parameter.DataSource

    # run segmentation
    if parameter.ImageProcessing.Method == "SpotDetection":

        detectCells = iDISCO.ImageProcessing.SpotDetection.detectCells

        centers, intensities = parallelProcessStack(
            ps.ImageFile,
            x=ps.XRange,
            y=ps.YRange,
            z=ps.ZRange,
            processes=pp.Processes,
            chunksizemax=pp.ChunkSizeMax,
            chunksizemin=pp.ChunkSizeMin,
            chunkoverlap=pp.ChunkOverlap,
            optimizechunks=pp.OptimizeChunks,
            optimizechunksizeincrease=pp.OptimizeChunkSizeIncrease,
            segmentation=detectCells,
            parameter=parameter.ImageProcessing)

    else:
        if haveIlastik:
            #ilastik does parallel processing so do sequential processing here
            detectCells = iDISCO.ImageProcessing.IlastikClassification.detectCells

            centers, intensities = sequentiallyProcessStack(
                ps.ImageFile,
                x=ps.XRange,
                y=ps.YRange,
                z=ps.ZRange,
                chunksizemax=pp.ChunkSizeMax,
                chunksizemin=pp.ChunkSizeMin,
                chunkoverlap=pp.ChunkOverlap,
                segmentation=detectCells,
                parameter=parameter.ImageProcessing)

        else:
            raise RuntimeError(
                "No Ilastik installed use SpotDectection instead!")

    timer.printElapsedTime("Main")

    if not parameter.ImageProcessing.Parameter.ThresholdSave is None:
        iid = intensities > parameter.ImageProcessing.Parameter.ThresholdSave
        centers = centers[iid, :]

    if not parameter.ImageProcessing.PointFile is None:
        io.writePoints(parameter.ImageProcessing.PointFile, centers)

    if not parameter.ImageProcessing.IntensityFile is None:
        io.writePoints(parameter.ImageProcessing.IntensityFile, intensities)

    return centers, intensities
Пример #2
0
def runCellDetection(parameter):
    """Detect cells in data"""
    
    timer = Timer();
    
    pp = parameter.StackProcessing;
    ps = parameter.DataSource;
    
    # run segmentation
    if parameter.ImageProcessing.Method == "SpotDetection":
        
        detectCells = iDISCO.ImageProcessing.SpotDetection.detectCells;
        
        centers, intensities = parallelProcessStack(ps.ImageFile, x = ps.XRange, y = ps.YRange, z = ps.ZRange, 
                                                processes = pp.Processes, chunksizemax = pp.ChunkSizeMax, chunksizemin = pp.ChunkSizeMin, chunkoverlap = pp.ChunkOverlap, 
                                                optimizechunks = pp.OptimizeChunks, optimizechunksizeincrease = pp.OptimizeChunkSizeIncrease,
                                                segmentation = detectCells, parameter = parameter.ImageProcessing);        
        
    else:
        if haveIlastik:
            #ilastik does parallel processing so do sequential processing here
            detectCells = iDISCO.ImageProcessing.IlastikClassification.detectCells;
            
            centers, intensities = sequentiallyProcessStack(ps.ImageFile, x = ps.XRange, y = ps.YRange, z = ps.ZRange, 
                                                        chunksizemax = pp.ChunkSizeMax, chunksizemin = pp.ChunkSizeMin, chunkoverlap = pp.ChunkOverlap,
                                                        segmentation = detectCells, parameter = parameter.ImageProcessing);
            
        else:
            raise RuntimeError("No Ilastik installed use SpotDectection instead!");
            
 
    timer.printElapsedTime("Main");
    
    if not parameter.ImageProcessing.Parameter.ThresholdSave is None:
        iid = intensities >  parameter.ImageProcessing.Parameter.ThresholdSave;
        centers = centers[iid,:];

    if not parameter.ImageProcessing.PointFile is None:
        io.writePoints(parameter.ImageProcessing.PointFile, centers);
        
    if not parameter.ImageProcessing.IntensityFile is None:
        io.writePoints(parameter.ImageProcessing.IntensityFile, intensities);

    return centers, intensities;
Пример #3
0
from iDISCO.ImageProcessing.Filter.StructureElement import structureElement
from iDISCO.Visualization.Plot import plotTiling, plotOverlayLabel

from iDISCO.Utils.Timer import Timer;


img = numpy.random.rand(2000,2000) * 65535;
img = img.astype('int')

dataraw = dataset[:,:,1160];

img = dataraw[:,:];
img.shape


t = Timer();
res = grey_opening(img,#DoG filter
t.printElapsedTime('scipy');


#t.reset();
#res2 = open(img, structureElement('Disk', (30,30)).astype('bool'));
#t.printElapsedTime('mahotas');

#t.reset();
#res2 = open(img, structureElement('Disk', (30,30)).astype('bool'));
#t.printElapsedTime('mahotas');

t.reset();
se = structureElement('Disk', (15,15)).astype('uint8');
res2 = cv2.morphologyEx(img, cv2.MORPH_OPEN, se)