def Dialog(imp):
    dpi = 300
    # a4 width in inches
    defaultWidth = 11.69
    defaultHeight = defaultWidth / ratio
    defaultAspectRatio = 1.41

    if imp:
        gd = GenericDialogPlus("Cover Maker")
        gd.addMessage("Input Options")
        gd.addFileField("Select image database", "", 20)
        gd.addMessage("Cover Maker Options")
        gd.addNumericField("tile width", 12, 0)
        gd.addNumericField("tile height", 9, 0)

        gd.showDialog()

        if gd.wasCanceled():
            print "User canceled dialog!"
            return
        databasepath = gd.getNextString()
        tilewidth = gd.getNextNumber()
        tileheight = gd.getNextNumber()

        return databasepath, imp.getWidth(), imp.getHeight(), int(
            tilewidth), int(tileheight)
    else:
        IJ.showMessage("You should have at least one image open.")
def Dialog(imp):
	dpi = 300
	# a4 width in inches
	defaultWidth = 11.69
	defaultHeight = defaultWidth/ratio
	defaultAspectRatio = 1.41

	if imp:
		gd = GenericDialogPlus("Cover Maker")
		gd.addMessage("Input Options")
		gd.addFileField("Select image database", "", 20)
		gd.addMessage("Cover Maker Options")
		gd.addNumericField("tile width", 12, 0)
		gd.addNumericField("tile height", 9, 0)

		gd.showDialog()

		if gd.wasCanceled():
			print "User canceled dialog!"
			return
		databasepath = gd.getNextString()
		tilewidth = gd.getNextNumber()
		tileheight = gd.getNextNumber()

		print 'path:', databasepath
		return databasepath, imp.getWidth(), imp.getHeight(), int(tilewidth), int(tileheight)
	else:
		IJ.showMessage( "You should have at least one image open." )
Example #3
0
def get_user_params(event):
    """ Allows user to select file and user parameters

    Parameters
    ----------
    event : Event
        Waits for get_user_params_JB JButton to be pressed
    
    Returns
    -------
    dict
        Dict containing filename, number of Gaussians to fit,
        % of dataset to import, whether to specify grey value
        limits, minimum grey value and maximum grey value to 
        consider (optional)
    """
    # Open user dialog
    gui = GenericDialogPlus("Define user parameters")
    gui.addFileField("Image filename", "Select image file")
    gui.addNumericField("Number of Gaussians to fit: ", 2, 0)
    gui.addNumericField("Percentage of dataset to import: ", 15, 0)
    gui.addCheckbox("Specify grey value limits?", False)
    gui.addNumericField("Min grey value (optional): ", 0, 0)
    gui.addNumericField("Max grey value (optional): ", 255, 0)
    gui.showDialog()

    # Extract user parameters
    if gui.wasOKed():
        user_params = {}  # empty dict
        user_params['img_fname'] = str(gui.getNextString())
        user_params['n_gaussians'] = int(gui.getNextNumber())
        user_params['pct_stack_import'] = float(gui.getNextNumber())
        user_params['specify_gv'] = gui.getNextBoolean()
        user_params['min_gv'] = float(gui.getNextNumber())
        user_params['max_gv'] = float(gui.getNextNumber())

    # Create results directory
    results_dir = os.path.splitext(user_params['img_fname'])[0] + "_results"
    if os.path.isdir(results_dir) == False:
        os.mkdir(results_dir)
    print("Results directory: {}".format(results_dir))

    # Write user parameters to text file
    user_params_fname = os.path.join(results_dir, "Users_Params.csv")
    with open(user_params_fname, "wb") as f:
        w = csv.DictWriter(f, user_params.keys())
        w.writeheader()
        w.writerow(user_params)

    # Write directory to look for user params to text file in main/
    temp_user_dir = os.path.join(os.path.dirname(__file__),
                                 "temp_user_dir.txt")
    if os.path.isfile(temp_user_dir) == True:
        os.remove(temp_user_dir)  # delete temp_user_dir.txt if present
    f = open(temp_user_dir, "w")
    f.write(user_params_fname)
    f.close()

    return user_params
def DialogGenerate(imageBaseDir, summary):
    dpi = 300
    defaultAspectRatio = 1.33
    defaultTileWidth = 15
    defaultOriginalWidth = 150
    defaultOriginalHeight = 113
    defaultTileHeight = round(defaultTileWidth / defaultAspectRatio)

    gd = GenericDialogPlus("Cover Maker")
    gd.addMessage("Prepare Image database")
    gd.addDirectoryField("Select base directory containing images",
                         imageBaseDir, 20)
    gd.addMessage(summary)
    gd.addNumericField("Aspect ratio", defaultAspectRatio, 2)
    gd.addNumericField("Original width", defaultOriginalWidth, 0)
    gd.addNumericField("Original height", defaultOriginalHeight, 0)
    gd.addNumericField("minimal tile width", defaultTileWidth, 0)
    gd.addNumericField("maximal tile width", defaultTileWidth, 0)
    gd.addNumericField("minimal tile height", defaultTileHeight, 0)
    gd.addNumericField("maximal tile height", defaultTileHeight, 0)

    fields = gd.getNumericFields()

    aspRatio = fields.get(0)
    minw = fields.get(3)
    maxw = fields.get(4)
    minh = fields.get(5)
    maxh = fields.get(6)

    # resolution and size listener
    textListener = RatioToDim(aspRatio, minw, maxw, minh, maxh)
    aspRatio.addTextListener(textListener)
    minw.addTextListener(textListener)
    maxw.addTextListener(textListener)

    gd.showDialog()

    if gd.wasCanceled():
        print "User canceled dialog!"
        return
    imageBaseDir = gd.getNextString()
    aspectRatio = gd.getNextNumber()
    majorWidth = gd.getNextNumber()
    majorHeight = gd.getNextNumber()
    mintilewidth = gd.getNextNumber()
    maxtilewidth = gd.getNextNumber()

    return int(mintilewidth), int(maxtilewidth), imageBaseDir, float(
        aspectRatio), int(majorWidth), int(majorHeight)
def DialogGenerate(imageBaseDir, summary):
	dpi = 300
	defaultAspectRatio = 1.33
	defaultTileWidth = 15
	defaultOriginalWidth = 150
	defaultOriginalHeight = 113
	defaultTileHeight = round(defaultTileWidth/defaultAspectRatio)

	gd = GenericDialogPlus("Cover Maker")
	gd.addMessage("Prepare Image database")
	gd.addDirectoryField("Select base directory containing images", imageBaseDir, 20)
	gd.addMessage(summary)
	gd.addNumericField("Aspect ratio", defaultAspectRatio, 2)
	gd.addNumericField("Original width", defaultOriginalWidth, 0)
	gd.addNumericField("Original height", defaultOriginalHeight, 0)
	gd.addNumericField("minimal tile width", defaultTileWidth, 0)
	gd.addNumericField("maximal tile width", defaultTileWidth, 0)
	gd.addNumericField("minimal tile height", defaultTileHeight, 0)
	gd.addNumericField("maximal tile height", defaultTileHeight, 0)

	fields = gd.getNumericFields()

	aspRatio = fields.get(0)
	minw = fields.get(3)
	maxw = fields.get(4)
	minh = fields.get(5)
	maxh = fields.get(6)

	# resolution and size listener
	textListener = RatioToDim(aspRatio, minw, maxw, minh, maxh)
	aspRatio.addTextListener(textListener)
	minw.addTextListener(textListener)
	maxw.addTextListener(textListener)

	gd.showDialog()

	if gd.wasCanceled():
		print "User canceled dialog!"
		return
	imageBaseDir = gd.getNextString()
	aspectRatio = gd.getNextNumber()
	majorWidth = gd.getNextNumber()
	majorHeight = gd.getNextNumber()
	mintilewidth = gd.getNextNumber()
	maxtilewidth = gd.getNextNumber()

	return int(mintilewidth), int(maxtilewidth), imageBaseDir, float(aspectRatio), int(majorWidth), int(majorHeight)
def SaveDialog(imp):
    dpi = 300
    # a4 width in inches
    defaultWidth = 11.69
    defaultHeight = defaultWidth / ratio
    defaultAspectRatio = 1.41

    if imp:
        gd = GenericDialogPlus("Cover Maker")
        gd.addMessage("Saving options")
        gd.addNumericField("resolution (dpi)", dpi, 0)
        gd.addNumericField("width (pixels)", defaultWidth * dpi, 0)
        gd.addNumericField("height (pixels)", defaultHeight * dpi, 0)
        gd.addNumericField("width (inches)", defaultWidth, 2)
        gd.addNumericField("height (inches)", defaultHeight, 2)
        gd.addFileField("Select Originals database", "", 20)

        fields = gd.getNumericFields()

        resField = fields.get(0)
        widthPixels = fields.get(1)
        heightPixels = fields.get(2)
        widthInches = fields.get(3)
        heightInches = fields.get(4)

        # resolution and size listener
        textListener = ResolutionListener(resField, widthPixels, heightPixels,
                                          widthInches, heightInches)
        resField.addTextListener(textListener)
        widthInches.addTextListener(textListener)
        heightInches.addTextListener(textListener)

        gd.showDialog()

        if gd.wasCanceled():
            print "User canceled dialog!"
            return

        newres = gd.getNextNumber()
        newwidth = gd.getNextNumber()
        newheight = gd.getNextNumber()
        originalspath = gd.getNextString()

        return int(newwidth), int(newheight), newres, originalspath
    else:
        IJ.showMessage("You should have at least one image open.")
Example #7
0
def get_parameters(p):
  gd = GenericDialogPlus("Please enter parameters")

  for k in p['expose_to_gui']['value']:
    if p[k]['type'] == 'boolean':
      gd.addCheckbox(k, p[k]['value'])
    elif p[k]['type'] == 'folder':
      gd.addDirectoryField(k, p[k]['value'], 100)	
    elif p[k]['type'] == 'file':
      gd.addFileField(k, p[k]['value'], 100)	
    elif p[k]['type'] == 'string':
      if p[k]['choices']:
        gd.addChoice(k, p[k]['choices'], p[k]['value'])	
      else:
        gd.addStringField(k, p[k]['value'])	 
    elif p[k]['type'] == 'int':
      if p[k]['choices']:
        gd.addChoice(k, p[k]['choices'], p[k]['value'])	
      else:
        gd.addNumericField(k, p[k]['value'], 0)	 
    elif p[k]['type'] == 'float':
      gd.addNumericField(k, p[k]['value'], 2)
  
  gd.showDialog()
  if gd.wasCanceled():
    return

  for k in p['expose_to_gui']['value']:
    if p[k]['type'] == 'boolean':
      p[k]['value'] = gd.getNextBoolean()
    elif p[k]['type'] == 'folder' or p[k]['type'] == 'file':
      p[k]['value'] = gd.getNextString()
    elif p[k]['type'] == 'string':
      if p[k]['choices']:
        p[k]['value'] = gd.getNextChoice()	
      else:
        p[k]['value'] = gd.getNextString()	 
    elif p[k]['type'] == 'int':
      if p[k]['choices']:
        p[k]['value'] = int(gd.getNextChoice())	
      else:
        p[k]['value'] = int(gd.getNextNumber()) 
    elif p[k]['type'] == 'float':
        p[k]['value'] = gd.getNextNumber()
    
  return p
def SaveDialog(imp):
	dpi = 300
	# a4 width in inches
	defaultWidth = 11.69
	defaultHeight = defaultWidth/ratio
	defaultAspectRatio = 1.41

	if imp:
		gd = GenericDialogPlus("Cover Maker")
		gd.addMessage("Saving options")
		gd.addNumericField("resolution (dpi)", dpi, 0)
		gd.addNumericField("width (pixels)", defaultWidth*dpi, 0)
		gd.addNumericField("height (pixels)", defaultHeight*dpi, 0)
		gd.addNumericField("width (inches)", defaultWidth, 2)
		gd.addNumericField("height (inches)", defaultHeight, 2)
		gd.addFileField("Select Originals database", "", 20)

		fields = gd.getNumericFields()

		resField = fields.get(0)
		widthPixels = fields.get(1)
		heightPixels = fields.get(2)
		widthInches = fields.get(3)
		heightInches = fields.get(4)

		# resolution and size listener
		textListener = ResolutionListener(resField, widthPixels, heightPixels, widthInches, heightInches)
		resField.addTextListener(textListener)
		widthInches.addTextListener(textListener)
		heightInches.addTextListener(textListener)

		gd.showDialog()

		if gd.wasCanceled():
			print "User canceled dialog!"
			return

		newres = gd.getNextNumber()
		newwidth = gd.getNextNumber()
		newheight = gd.getNextNumber()
		originalspath = gd.getNextString()

		return int(newwidth), int(newheight), newres, originalspath
	else:
		IJ.showMessage( "You should have at least one image open." )
def make_dialog():

	parameters = {}

	gd = GenericDialogPlus("Grid Stitch SDC Data")
	gd.addMessage(  "Warning!\n"\
					"In order to display a fused image upon completion of stitching\n"\
					"please disable Fiji's ImageJ2 options. When enabled an ImageJ\n"\
					"exception will be displayed upon completion. This exception can\n"
					"be safely ignored.")
	gd.addMessage(  "Information\n"\
					"This plugin is a wrapper around the Fiji 'Grid Stitching' plugin.\n"\
					"It allows tiles generated in SlideBook to be directly stitched by\n"\
					"by first writing out the individual tiles, executing the 'Grid Stitching'\n"\
					"plugin and writing the fused image to disk.")
	gd.addMessage("")										
	gd.addNumericField("grid_size_x", 3, 0)
	gd.addNumericField("grid_size_y", 3, 0)
	gd.addCheckbox("Select channel",False)
	gd.addNumericField("", 0, 0)		
	gd.addCheckbox("Are the Z slices separate files?",False)
	gd.addDirectoryField("directory", "", 50)
	
	gd.showDialog()
	if (gd.wasCanceled()): return
		
	parameters['gridX'] = int(math.ceil(gd.getNextNumber()))
	parameters['gridY'] = int(math.ceil(gd.getNextNumber()))
	parameters['select_channel'] = gd.getNextBoolean()
	parameters['channel'] = None
	if parameters['select_channel']:
		parameters['channel'] = int(gd.getNextNumber())
	parameters['separate_z'] = gd.getNextBoolean()
	directory = str(gd.getNextString())	
	if directory is None:
	# User canceled the dialog
		return None
	else:
		directory = os.path.abspath(directory)
		parameters['directory'] = directory + os.path.sep

	return parameters
def get_parameters(p):
  gd = GenericDialogPlus("Please enter parameters")

  for k in p['expose_to_gui']['value']:
    if p[k]['type'] == 'folder':
      gd.addDirectoryField(k, p[k]['value'], 100)	
    if p[k]['type'] == 'file':
      gd.addFileField(k, p[k]['value'], 100)	
    elif p[k]['type'] == 'string':
      if p[k]['choices']:
        gd.addChoice(k, p[k]['choices'], p[k]['value'])	
      else:
        gd.addStringField(k, p[k]['value'], 50)	 
    elif p[k]['type'] == 'int':
      if p[k]['choices']:
        gd.addChoice(k, p[k]['choices'], p[k]['value'])	
      else:
        gd.addNumericField(k, p[k]['value'], 0)	 
    elif p[k]['type'] == 'float':
      gd.addNumericField(k, p[k]['value'], 2)
  
  gd.showDialog()
  if gd.wasCanceled():
    return(0)

  for k in p['expose_to_gui']['value']:
    if p[k]['type'] == 'folder' or p[k]['type'] == 'file':
      p[k]['value'] = gd.getNextString()
    elif p[k]['type'] == 'string':
      if p[k]['choices']:
        p[k]['value'] = gd.getNextChoice()	
      else:
        p[k]['value'] = gd.getNextString()	 
    elif p[k]['type'] == 'int':
      if p[k]['choices']:
        p[k]['value'] = int(gd.getNextChoice())	
      else:
        p[k]['value'] = int(gd.getNextNumber()) 
    elif p[k]['type'] == 'float':
        p[k]['value'] = gd.getNextNumber()
    
  return(p)
Example #11
0
    def getSettings(self):
        gd = GenericDialogPlus("Settings")
        gd.addNumericField("Distance in pixel", 600, 0)
        gd.addNumericField("Distance in cm", 2.54, 2)
        gd.addNumericField("Min. size (cm^2)", 0.5, 2)
        gd.addDirectoryField("Directory", IJ.getDirectory("home"))
        gd.addStringField("File extension", "*.jpg", 8)
        gd.showDialog()

        if gd.wasCanceled():
            sys.exit()
        else:
            distPixel = gd.getNextNumber()
            distCm = gd.getNextNumber()
            minSize = gd.getNextNumber() * (distPixel / distCm) ** 2
            imageDir = gd.getNextString()
            ext = gd.getNextString()

        return (distPixel, distCm, minSize, imageDir, ext)
Example #12
0
#Take spectral image data and transform into XYZ tristumulus Space

from ij import IJ, ImagePlus
from ij.plugin import ImageCalculator
from ij.process import ImageProcessor
from ij.process import FloatProcessor
from fiji.util.gui import GenericDialogPlus
import ij.plugin.PlugIn
import math

#Input parameters
gd = GenericDialogPlus("Input Parameters")
gd.addNumericField("Wavlength Spacing (nm)", 5, 0)  # show 3 decimals
gd.addNumericField("Starting Wavelength (nm)", 430, 0)  # show 3 decimals
gd.addNumericField("Ending Wavelength (nm)", 750, 0)  # show 3 decimals
gd.showDialog()

spacing = int(gd.getNextNumber())
start_wave = int(gd.getNextNumber())
end_wave = int(gd.getNextNumber())

lim = (end_wave - start_wave) / spacing


#color matching functions
def red():

    a0 = 0.2817
    a1 = -0.3183
    b1 = -0.07613
    a2 = 0.1517
Example #13
0
from ij import IJ, ImagePlus
from ij.plugin import ImageCalculator
from ij.process import ImageProcessor
from ij.process import FloatProcessor
from fiji.util.gui import GenericDialogPlus

#Input parameters
gd = GenericDialogPlus("Input Parameters")
gd.addDirectoryOrFileField("Select composite color image, 32-bit", "")
gd.addNumericField("Pixel size", 4, 0)  # show 3 decimals
gd.addNumericField("Background color", 150, 0)  # show 3 decimals
gd.showDialog()

directory_w = gd.getNextString()
px = int(gd.getNextNumber())
bc = int(gd.getNextNumber())

#path to RGB image
IJ.open(str(directory_w))
imp = IJ.getImage()
IJ.run("8-bit")
IJ.run("32-bit")

n_slicesa = imp.getStack().getSize()
L = []
for i in range(1, n_slicesa + 1):
    imp.setSlice(i)
    n = imp.getProcessor().getPixels()
    n2 = [int(val) for val in n]
    L.append(n2)
imp.changes = False
Example #14
0
#||X-Dw||
#Requires mpv2 package: http://www.ux.uis.no/~karlsk/dle/mpv2-class.zip
#Improvements  to come in the next version

from ij import IJ, ImagePlus
from ij.plugin import ImageCalculator
from ij.process import ImageProcessor
from ij.process import FloatProcessor
from fiji.util.gui import GenericDialogPlus
from mpv2 import MatchingPursuit as MP, JamaMatrix as Matrix, SymmetricMatrix as SM

#Input parameters
gd = GenericDialogPlus("Sparse Approximation, Input Parameters")
gd.addDirectoryOrFileField("Select dictionary", "")
gd.addChoice("Greedy algorithm type", ["MP", "OMP", "ORMP"], "OMP")
gd.addNumericField("Number of non-zero elements", 3, 0)  # show 3 decimals
gd.showDialog()

directory_w = gd.getNextString()
t_w = int(gd.getNextNumber())
Rt = gd.getNextChoice()

imp2 = IJ.getImage()
IJ.run("32-bit")
imp2 = IJ.getImage()

#path to lighting directions
IJ.run("Text Image... ", "open=" + str(directory_w))
imp = IJ.getImage()
imp.setTitle("Dictionary Atoms")
from fiji.util.gui import GenericDialogPlus
# rest of imports below on purpose (otherwise searchRoi lost)

## Create GUI
Win = GenericDialogPlus("Multiple Template Matching")
Win.addImageChoice("Template", prefs.get("Template", "Choice"))
Win.addImageChoice("Image", prefs.get("Image", "Choice"))
Win.addCheckbox("Flip_template_vertically", prefs.getInt("FlipV", False))
Win.addCheckbox("Flip_template_horizontally", prefs.getInt("FlipH", False))
Win.addStringField("Rotate template by ..(comma-separated)",
                   prefs.get("Angles", ""))
Win.addChoice("Matching_method", [
    "Normalised Square Difference", "Normalised cross-correlation",
    "Normalised 0-mean cross-correlation"
], prefs.get("Method", "Normalised 0-mean cross-correlation"))
Win.addNumericField("Number_of_objects expected", prefs.getInt("N_hit", 1), 0)
Win.addMessage("If more than 1 object expected :")
Win.addSlider("Score_Threshold", 0, 1, prefs.getFloat("Score_Threshold", 0.5),
              0.1)
#Win.addNumericField("Min_peak_height relative to neighborhood ([0-1], decrease to get more hits)", prefs.getFloat("Tolerance",0.1), 2)
Win.addSlider("Maximal_overlap between Bounding boxes", 0, 1,
              prefs.getFloat("MaxOverlap", 0.4), 0.1)
Win.addMessage("Outputs")
Win.addCheckbox("Add_ROI detected to ROI manager",
                prefs.getInt("AddRoi", True))
Win.addCheckbox("Show_result table", prefs.getInt("ShowTable", False))
Win.addMessage("Version 1.1.2")
Win.addMessage("""If you use this plugin please cite :
Thomas, L.S.V., Gehrig, J. 
Multi-template matching: a versatile tool for object-localization in microscopy images. 
BMC Bioinformatics 21, 44 (2020). https://doi.org/10.1186/s12859-020-3363-7""")
Example #16
0
	    __dict__[k] = v
	print(thing)
except Exception as e: print(e)
gd = GenericDialog("Analysis parameters")
gd.addDirectoryField("Image folder location", folderPath )
gd.addStringField("Image filename pattern", formatString, 70)
gd.addStringField("Group By", groupBy, 70)
gd.addStringField("Nuclear Stain Channel Name", nucChannel, 70)
gd.addStringField("Cardiomyocyte Image Channel Name", cmChannel, 70)
gd.addCheckbox("Are images stitched by well", stitched)
gd.addChoice("Nuclear thresholding method", methodsList, nucMethod)
gd.addCheckbox("Threshold nuclei by stack?", analyzeNucStack)
gd.addCheckbox("Are the cardiomyocyte images brightfield?", brightfield)
gd.addChoice("Cardiomyocyte thresholding method", methodsList,  cmMethod)
gd.addCheckbox("Threshold cardiomyocyes by stack?", analyzeCmStack)
gd.addNumericField("Rows per well", rowNo, 0)
gd.addNumericField("Columns per well", colNo, 0)
gd.addNumericField("Nuclear minimum size (pixels)", nucMinSize, 0)
gd.addNumericField("Cardiomyocyte minimum size (pixels)", cmMinSize, 0)
gd.showDialog()
folderPath = gd.getNextString() + "/"
formatString = gd.getNextString()
groupBy = re.findall(r"\w+", gd.getNextString())
nucChannel = gd.getNextString()
cmChannel = gd.getNextString()
stitched = gd.getNextBoolean()
nucMethod = gd.getNextChoice()
analyzeNucStack = gd.getNextBoolean()
brightfield = gd.getNextBoolean()
cmMethod = gd.getNextChoice()
analyzeCmStack = gd.getNextBoolean()
from ij import IJ, ImagePlus, ImageStack
from ij.process import ImageProcessor, FloatProcessor
from fiji.util.gui  import GenericDialogPlus

gd = GenericDialogPlus("Input Parameters")  
gd.addNumericField("Number of Angles", 10, 0)  # show 3 decimals
gd.showDialog() 

ang = 360/int(gd.getNextNumber())  


imp = IJ.getImage()

n_slices = imp.getStack().getSize()


for i in range(1, n_slices+1):
	imp.setSlice(i) 
	s = ((i*ang)-ang)*-1
	IJ.run("Rotate... ", "angle="+str(s) + " grid=1 interpolation=Bilinear slice")

Example #18
0
#@PrefService prefs
from fiji.util.gui import GenericDialogPlus

## Create GUI
Win = GenericDialogPlus("Multiple Template Matching")
Win.addImageChoice("Template", prefs.get("Template", "Choice"))
Win.addImageChoice("Image", prefs.get("Image", "Choice"))
Win.addCheckbox("Flip_template_vertically", prefs.getInt("FlipV", False))
Win.addCheckbox("Flip_template_horizontally", prefs.getInt("FlipH", False))
Win.addStringField("Rotate template by ..(comma-separated)",
                   prefs.get("Angles", ""))
Win.addChoice("Matching_method", [
    "Normalised Square Difference", "Normalised cross-correlation",
    "Normalised 0-mean cross-correlation"
], prefs.get("Method", "Normalised 0-mean cross-correlation"))
Win.addNumericField("Number_of_templates expected", prefs.getInt("N_hit", 1),
                    0)
Win.addMessage("If more than 1 template expected :")
Win.addNumericField("Score_Threshold [0-1]",
                    prefs.getFloat("Score_Threshold", 0.5), 2)
#Win.addNumericField("Min_peak_height relative to neighborhood ([0-1], decrease to get more hits)", prefs.getFloat("Tolerance",0.1), 2)
Win.addNumericField("Maximal_overlap between Bounding boxes [0-1]",
                    prefs.getFloat("MaxOverlap", 0.4), 2)
Win.addMessage("Outputs")
Win.addCheckbox("Add_ROI detected to ROI manager",
                prefs.getInt("AddRoi", True))
Win.addCheckbox("Show_result table", prefs.getInt("ShowTable", False))
Win.addMessage("""If you use this plugin please cite :
Laurent SV Thomas, Jochen Gehrig
bioRxiv 619338; doi: https://doi.org/10.1101/619338""")
Win.addHelp(
    "https://github.com/multi-template-matching/MultiTemplateMatching-Fiji/wiki"
Example #19
0
analyses = ["Counts", "ATP"]
yn = ["YES", "NO"]

gdp = GenericDialogPlus("Ex Vivo Granule Analysis")
gdp.addMessage("Choose a UNIQUE directory to save analysis files")
gdp.addDirectoryOrFileField("Output Directory", "D:/Samantha/")
gdp.addMessage("IMPORTANT: Files are tracked based on input order")
gdp.addMessage("Select input files (.tiff)...")
gdp.addFileField("Wildtype", "D:/Samantha/test/VLEwt.tif")
gdp.addFileField("DIC", "D:/Samantha/test/dic.tif")
gdp.addFileField("Mutant", "D:/Samantha/test/ddmut.tif")
gdp.addFileField("Background (DAPI)", "D:/Samantha/test/bg.tif")
gdp.addChoice("Select analysis type", analyses, "Counts")
gdp.addMessage("Choose variable conditions:")
gdp.addNumericField(
    "Minimum Threshold. Choose value (0-1) as a percent of maximum threshold",
    0.20, 2)
gdp.addNumericField("Minimum granule size (pixel^2)", 20, 0)
gdp.addNumericField(
    "Minimum granule circularity/shape. 1.0 = perfect cirlce, 0.5 = ellipse, 0.0 = rod",
    0.50, 3)
gdp.addNumericField("Maximum granule circularity", 1.00, 3)
gdp.addNumericField(
    "Minimum percent overlap between images (0 = no overlap required, 100 = perfect overlap)",
    25, 0)
gdp.addChoice(
    "Exclude particles on outside perimeter? Recommended for ATP analysis", yn,
    "NO")
gdp.showDialog()
outdir = gdp.getNextString()
path_wt = gdp.getNextString()