def find_peaks(imp1, imp2, sigmaSmaller, sigmaLarger, minPeakValue): # FIND PEAKS # sigmaSmaller ==> Size of the smaller dots (in pixels) # sigmaLarger ==> Size of the bigger dots (in pixels) # minPeakValue ==> Intensity above which to look for dots # Preparation Neuron channel ip1_1 = IL.wrapReal(imp1) ip1E = Views.extendMirrorSingle(ip1_1) imp1.show() #Preparation Glioma channel ip2_1 = IL.wrapReal(imp2) ip2E = Views.extendMirrorSingle(ip2_1) imp2.show() calibration = [1.0 for i in range(ip1_1.numDimensions())] extremaType = DogDetection.ExtremaType.MINIMA normalizedMinPeakValue = False dog_1 = DogDetection(ip1E, ip1_1, calibration, sigmaSmaller, sigmaLarger, extremaType, minPeakValue, normalizedMinPeakValue) dog_2 = DogDetection(ip2E, ip2_1, calibration, sigmaSmaller, sigmaLarger, extremaType, minPeakValue, normalizedMinPeakValue) peaks_1 = dog_1.getPeaks() peaks_2 = dog_2.getPeaks() return ip1_1, ip2_1, peaks_1, peaks_2
from net.imglib2.realtransform import RealViews as RV from net.imglib2.realtransform import AffineTransform3D from net.imglib2.img.display.imagej import ImageJFunctions as IL from ij import IJ from net.imglib2.view import Views from net.imglib2.interpolation.randomaccess import NLinearInterpolatorFactory from net.imglib2.util import Intervals from math import radians, floor, ceil from jarray import zeros from pprint import pprint # Load an image (of any dimensions) imp = IJ.getImage() # Access its pixel data as an ImgLib2 RandomAccessibleInterval img = IL.wrapReal(imp) # View as an infinite image, with value zero beyond the image edges imgE = Views.extendZero(img) # View the pixel data as a RealRandomAccessible # (that is, accessible with sub-pixel precision) # by using an interpolator imgR = Views.interpolate(imgE, NLinearInterpolatorFactory()) # Define a rotation by +30 degrees relative to the image center in the XY axes angle = radians(30) toCenter = AffineTransform3D() cx = img.dimension(0) / 2.0 # X axis cy = img.dimension(1) / 2.0 # Y axis toCenter.setTranslation(-cx, -cy, 0.0) # no translation in the Z axis