import ClearMap.IO.IO as io import os import ClearMap.Visualization.Plot as plt import ClearMap.Analysis.Label as lbl import numpy as np sampleName = 'LowNIC' #execfile('/d2/studies/ClearMap/IA_iDISCO/' + sampleName + '/parameter_file_' + sampleName + '.py') execfile( '/d2/studies/ClearMap/Alex_Acute_iDISCO/3RB_HighNIC/parameter_file_template_3RB.py' ) baseDirectory = '/d2/studies/ClearMap/Alex_Acute_iDISCO/NIC_HeatMaps/FiguresForPaper/' region = 'MSC' points = io.readPoints(TransformedCellsFile) data = plt.overlayPoints(AnnotationFile, points.astype(int), pointColor=None) io.writeData( os.path.join(BaseDirectory, sampleName + '_Annotations_Points_Overlay_newAtlas2.tif'), data) data = data[:, :, :, 1:] io.writeData( os.path.join(BaseDirectory, sampleName + '_Points_Transformed_newAtlas2.tif'), data) label = io.readData(AnnotationFile) label = label.astype('int32') labelids = np.unique(label) outside = np.zeros(label.shape, dtype=bool) """
#row = (0,0) : peak intensity from the raw data #row = (1,1) : peak intensity from the DoG filtered data #row = (2,2) : peak intensity from the background subtracted data #row = (3,3) : voxel size from the watershed points, intensities = thresholdPoints(points, intensities, threshold=3000, row=(0, 0)) io.writePoints(FilteredCellsFile, (points, intensities)) ## Check Cell detection (For the testing phase only, remove when running on the full size dataset) ####################### import ClearMap.Visualization.Plot as plt pointSource = os.path.join(BaseDirectory, FilteredCellsFile[0]) data = plt.overlayPoints(cFosFile, pointSource, pointColor=None, **cFosFileRange) io.writeData(os.path.join(BaseDirectory, 'cells_check.tif'), data) # Transform point coordinates ############################# points = io.readPoints(CorrectionResamplingPointsParameter["pointSource"]) points = resamplePoints(**CorrectionResamplingPointsParameter) points = transformPoints( points, transformDirectory=CorrectionAlignmentParameter["resultDirectory"], indices=False, resultDirectory=None) CorrectionResamplingPointsInverseParameter["pointSource"] = points points = resamplePointsInverse(**CorrectionResamplingPointsInverseParameter) RegistrationResamplingPointParameter["pointSource"] = points
#points, intensities = thresholdPoints(points,cintensity, threshold = (5,20), row = (1,1)); points, cellSizesPost = thresholdPoints(points, cellSizesPre, threshold=pointsThresh, row=threshType) #pdb.set_trace() #io.writeData(os.path.join(homeDir, 'Results/OverlayWatershed.tif'), overlay_Img); overlay_Img = plt.fredOverlayPoints(cfos_fn, points, pointColor=[200, 0, 0]) io.writeData(os.path.join(resultDir, fName + '_PointsOriginalImg.tif'), overlay_Img) overlay_Img = plt.overlayPoints(imgD, points, pointColor=[200, 0, 0]) io.writeData(os.path.join(resultDir, fName + '_PointsFilterDoG.tif'), overlay_Img) #Convert points from 3d to 2d points = numpy.delete(points, 2, axis=1) io.writePoints(points_fn, points) ##############################################################333 imgR = io.readData(auto_fn) imgR = imgR[..., numpy.newaxis] imgR = imgR.astype('int16') imgR, scaleFactor = resampleData(imgR, auto_R_fn, orientation=(1, 2, 3),
""" 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, 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)