示例#1
0
def run():
    gd = GenericDialogPlus("ND2 Conversion Tool")
    gd.addMessage("This plugin uses BioFormats to convert ND2 images to JPEG for further processing in ImageJ.")
    gd.addDirectoryOrFileField("Input: ", "G:\\Subdir testing\\") #srcDir
    gd.addDirectoryOrFileField("Output: ", "G:\\Subdir testing\\") #dstDir
    gd.addStringField("File name contains: ", "") #nameContains
    gd.addCheckbox("Preserve directory structure?", True) #keepDirs
    gd.addCheckbox("Run in headless mode?", True) #anneBoleyn 
    gd.addCheckbox("Overwrite existing output files?", True)
    gd.showDialog()
    if gd.wasCanceled():
        return
    srcDir = gd.getNextString()
    dstDir = gd.getNextString()
    nameContains = gd.getNextString()
    keepDirectories = gd.getNextBoolean()
    anneBoleyn = gd.getNextBoolean()
    overOut = gd.getNextBoolean()
    IJ.run("Input/Output...", "jpeg=100")
    for root, directories, filenames in os.walk(srcDir):
        for filename in filenames:
            # Check for file extension
            if not filename.endswith(".nd2"):
                continue
            # Check for file name pattern
            if nameContains not in filename:
                continue
            process(srcDir, dstDir, nameContains, root, filename, keepDirectories, anneBoleyn, overOut)
def getPaths():
    """Dialog box for user to select illumination intensity and dark image files.
    Illumination intensity file should be a .nd file pointing to the timelapse tifs, 
    and dark image file should be a single tif"""
    gd = GenericDialogPlus('File selection')
    gd.addFileField('Illumination stability timelapse (.nd file): ', None)
    gd.addFileField('Dark image (TIF): ', None)

    gd.showDialog()

    stackpath = gd.getNextString()
    darkpath = gd.getNextString()
    
    return stackpath, darkpath
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." )
示例#4
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)
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)
def DialogAnalyze():
    dpi = 300
    defaultAspectRatio = 1.41

    gd = GenericDialogPlus("Cover Maker")
    gd.addMessage("Prepare Image database")
    gd.addDirectoryField("Select base directory containing images", "", 20)

    gd.showDialog()

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

    return imageBaseDir
def DialogAnalyze():
	dpi = 300
	defaultAspectRatio = 1.41

	gd = GenericDialogPlus("Cover Maker")
	gd.addMessage("Prepare Image database")
	gd.addDirectoryField("Select base directory containing images", "", 20)

	gd.showDialog()

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

	return imageBaseDir
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)
示例#9
0
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.")
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." )
示例#12
0
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 selectionDialog(categories,labelColorBarImp):
	gd = GenericDialogPlus("ROI labeller -image picking")
	imps = WM.getImageTitles()
	nonimages=WM.getNonImageTitles()
	
	gd.addChoice("Image to quantify", imps, imps[0])
	try:
		gd.addChoice("FRETENTATOR results table", nonimages, nonimages[0])
		fail=0
	except:
		gd.addMessage("No results table open")
		fail=1
	gd.addImage(labelColorBarImp)
	for i in range(categories):
		gd.addStringField("Label "+str(i) +" name:", "Label "+str(i))

	gd.addChoice("Quantify an open image or add labels to open results table?", ["Image", "Results table"], "Results table")
	
	#quantImp= IJ.getImage(gd.getNextChoice())
	
	
	gd.setModal(False)
	gd.showDialog()
	while ((not gd.wasCanceled()) and not (gd.wasOKed())):
		Thread.sleep(50)


	names=dict()
	
	for i in range(categories):
		names[i]=str(gd.getNextString())
	imageName=gd.getNextChoice()
	if fail==0:	
		resultsName=gd.getNextChoice()
		imageOrTable=gd.getNextChoice()
	else:
		imageOrTable="Image"
		resultsName=0
	return names, imageName, resultsName, imageOrTable
示例#14
0
gdp.addStringField("", '4', 5)
gdp.addMessage(" ")
gdp.addMessage("Set R0 range (timepoint position x1 to x2):", boldFont)
gdp.addStringField("x1:", '2', 3)
gdp.addToSameRow()
gdp.addStringField(" x2:", '8', 3)
gdp.addMessage("Set output file headers:", boldFont)
gdp.addStringField("Channel 1:", 'A', 8)
gdp.addToSameRow()
gdp.addStringField("Channel 2:", 'B', 8)
gdp.addStringField("Channel Z/Channel W:", 'C', 8)
gdp.addToSameRow()
gdp.addStringField("R/R0:", 'D', 8)
gdp.showDialog()
if gdp.wasOKed():
    dest = gdp.getNextString().strip()
    ProFolder = gdp.getNextString().strip()
    Procsv = gdp.getNextString().strip()
    radius = int(gdp.getNextString().strip())
    interval = int(gdp.getNextString().strip())
    errorval = gdp.getNextString().strip()
    f_f = gdp.getNextRadioButton()
    back_state = gdp.getNextString().strip()
    back_val = int(gdp.getNextString().strip())
    blur_state = gdp.getNextBoolean()
    blur_val = int(gdp.getNextString().strip())
    r_start = int(gdp.getNextString().strip())
    r_end = int(gdp.getNextString().strip())
    ch1_str = gdp.getNextString().strip()
    ch2_str = gdp.getNextString().strip()
    ch12_str = gdp.getNextString().strip()
示例#15
0
from ij.gui import GenericDialog
from fiji.util.gui import GenericDialogPlus
import os, shutil

gdp = GenericDialogPlus("File Mover")
file_type = gdp.getNextString()
gdp.addStringField("File Extension ", '.tif', 5)
x = gdp.addDirectoryField("Source: ", " ")
gdp.addDirectoryField("Destination: ", " ")
gdp.showDialog()
if gdp.wasOKed():
    file_type = gdp.getNextString().strip()
    source_path = gdp.getNextString()
    dest_path = gdp.getNextString()
    print(file_type)
    print("source " + source_path)
    print("dest " + dest_path)
else:
    exit()

moved = 'Moved Images'
path = os.path.join(dest_path, moved)
try:
    dest = os.mkdir(path)
except OSError as error:
    print("Error: Moved Images is already present")
    exit()


def move():
    for root, dirs, files in os.walk((os.path.normpath(source_path)),
示例#16
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
gdp.addCheckbox("Mean_Max Detection", mean_max_def)
gdp.addToSameRow()
gdp.addCheckbox("Manual Background Selection", man_bck_def)
gdp.addCheckbox("Auto Position Image Window (position x,y):", auto_pos_def)

gdp.addStringField("x: ", xpos_def, 5)

gdp.addStringField("y: ", ypos_def, 5)
gdp.addMessage("------------------------------------------------------------", italicFont)
progress = images_processed(dest)
gdp.addMessage(str(progress[0])+'% Images Assayed' + ' ' +
               '(' + str(progress[2]) + '/' + str(progress[1]) + ')', italicFont)
gdp.addHelp("https://github.com/JohnSargeant-rgb")
gdp.showDialog()
if gdp.wasOKed():
    dest = gdp.getNextString().strip()
    ProFolder = gdp.getNextString().strip()
    Quant = gdp.getNextString().strip()
    Quant_MM = gdp.getNextString().strip()
    transport_c = gdp.getNextChoice()
    file_type = gdp.getNextString().strip()
    golgi_c = gdp.getNextChoice()
    extension = gdp.getNextString().strip()
    zoom_to = int(gdp.getNextChoice())
    radius = gdp.getNextString().strip()
    color_scale = gdp.getNextChoice()
    always_select = gdp.getNextBoolean()
    always_auto = gdp.getNextBoolean()
    mean_max_det = gdp.getNextBoolean()
    man_bck_det = gdp.getNextBoolean()
    auto_pos_det = gdp.getNextBoolean()
示例#18
0
# Outputs
Win.addMessage("Outputs")
Win.addCheckbox("Open_images as a stack (must have identical sizes)",
                prefs.getInt("ShowImages", True))
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/LauLauThom/MultiTemplateMatching/wiki")

Win.showDialog()

if Win.wasOKed():
    TemplatePath = Win.getNextString()
    ImagePath = Win.getNextString()
    RoiPath = Win.getNextString()
    flipv = Win.getNextBoolean()
    fliph = Win.getNextBoolean()
    angles = Win.getNextString()
    method = Win.getNextChoice()
    n_hit = int(Win.getNextNumber())
    score_threshold = Win.getNextNumber()
    #tolerance   = Win.getNextNumber()
    tolerance = 0
    max_overlap = Win.getNextNumber()
    show_images = Win.getNextBoolean()
    add_roi = Win.getNextBoolean()
    show_table = Win.getNextBoolean()
gd.addStringField("(Further) Registration Params","",50);
regparamf = gd.getStringFields().get(4)
gd.addStringField("Additional Arguments to munger.pl","",50);

regrootf.addTextListener(RegRootListener())
imgdirf.addTextListener(ImageDirListener())
outsuffixf.addTextListener(OuputSuffixListener())
choicef.addItemListener(RegParamListener())
# used for errors etc
gd.addMessage("Start by choosing a registration directory or images directory!")
statusf=gd.getMessage()
gd.showDialog()
if gd.wasCanceled():
	sys.exit("User cancelled!")
# Process Dialog Choices
rootDir=gd.getNextString()
os.chdir(rootDir)
refBrain=gd.getNextString()
image=gd.getNextString()
image=relpath(image,rootDir)
print refBrain
refBrain=relpath(refBrain,rootDir)
print refBrain

affine=gd.getNextBoolean()
ch01=gd.getNextBoolean()
warp=gd.getNextBoolean()
ch02=gd.getNextBoolean()
reformat=gd.getNextBoolean()
ch03=gd.getNextBoolean()
munger_actions=""
示例#20
0
from ij.gui import Roi, PolygonRoi, GenericDialog, TextRoi, NonBlockingGenericDialog
import os
from fiji.util.gui import GenericDialogPlus
import re

gdp=GenericDialogPlus("File Derandomizer")
gdp.addFileField("'Key' path :", " ")
gdp.addFileField("Data file :", " ")
gdp.addDirectoryField("Derandomized path", "(optional)")
gdp.addDirectoryField("Processed Image Folder", " ")
gdp.addCheckbox("Derandomize Data File", True)
gdp.addCheckbox("Derandomize Image Folder", False)

gdp.showDialog()
if gdp.wasOKed():
	key_path = gdp.getNextString().strip()
	data_path = gdp.getNextString().strip()
	deR_path = gdp.getNextString().strip()
	pi_path= gdp.getNextString().strip()
	ddf=gdp.getNextBoolean()
	dif=gdp.getNextBoolean()
	if deR_path == "(optional)":
		deR_path = os.path.dirname(data_path) 
else:
	exit()


# function to return key for any value
def get_key(val):
    for key, value in random.items():
         if val == value:
示例#21
0
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()
path_dic = gdp.getNextString()
path_mut = gdp.getNextString()
path_bg = gdp.getNextString()
analysistype = gdp.getNextChoice()
uThres = gdp.getNextNumber()
uGsize = gdp.getNextNumber()
uGshape = gdp.getNextNumber()
uGshapemax = gdp.getNextNumber()
uOverlap = gdp.getNextNumber()
uExclude = gdp.getNextChoice()

# Files will automatically be output to a new Fiji_Analysis directory. If this directory already exists, files will be overwritten. This checks to make sure the directory does not yet exist.
if path.exists(outdir + File.separatorChar +
               "Fiji_Analysis") and path.isdir(outdir + File.separatorChar +
示例#22
0
    delIp.close()
    cmIp = WindowManager.getImage("CmStain-Closing")
    IJ.run(cmIp,"Fill Holes", "stack")
  cmIp.show()
  IJ.run("Set Measurements...", "stack redirect=None decimal=3")
  IJ.run(cmIp, "Analyze Particles...", "size={}-Infinity show=[Masks] exclude in_situ stack".format(cmMinSize))
  cmMaskIp = cmIp.duplicate()
  IJ.run(cmIp, "Analyze Particles...", "size={}-Infinity show=[Count Masks] exclude in_situ stack".format(cmMinSize))
  cmMaskIp.show(), cmIp.show()
  return cmIp, cmMaskIp

import re
preGd = GenericDialog("Output Folder")
preGd.addDirectoryField("Output folder", "")
preGd.showDialog()
outputFolder = preGd.getNextString()
os.chdir(outputFolder)
folderPath, formatString, groupBy, nucChannel, cmChannel, stitched, analyzeNucStack, brightfield, nucMethod, cmMethod, analyzeCmStack, rowNo, colNo, nucMinSize, cmMinSize =\
"",          "",          "",      "DAPI",      "GFP",    False,    True,            False,      "Otsu",    "Triangle", True,         8,     7,      50,        500
__dict__ = globals()
try:
	with open("savedSettings.json") as f:
	  thing = json.load(f)
	  for k, v in thing.iteritems():
	    __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)
示例#23
0
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"
)

Win.showDialog()

if Win.wasOKed():
    template = Win.getNextImage()
    image = Win.getNextImage()
    flipv = Win.getNextBoolean()
    fliph = Win.getNextBoolean()
    angles = Win.getNextString()
    method = Win.getNextChoice()
    n_hit = int(Win.getNextNumber())
    score_threshold = Win.getNextNumber()
    #tolerance   = Win.getNextNumber()
    tolerance = 0
    max_overlap = Win.getNextNumber()
    add_roi = Win.getNextBoolean()
    show_table = Win.getNextBoolean()

    # Save for persistence
    ImageName = image.getTitle()
    prefs.put("Template", template.getTitle())
    prefs.put("Image", ImageName)
    prefs.put("FlipV", flipv)
    prefs.put("FlipH", fliph)
示例#24
0
    regparamf = gd.getStringFields().get(4)
    gd.addStringField("Additional Arguments to munger.pl", "", 50)

    regrootf.addTextListener(RegRootListener())
    imgdirf.addTextListener(ImageDirListener())
    outsuffixf.addTextListener(OuputSuffixListener())
    choicef.addItemListener(RegParamListener())
    # used for errors etc
    gd.addMessage(
        "Start by choosing a registration directory or images directory!")
    statusf = gd.getMessage()
    gd.showDialog()
    if gd.wasCanceled():
        sys.exit("User cancelled!")
    # Process Dialog Choices
    rootDir = gd.getNextString()
    os.chdir(rootDir)
    refBrain = gd.getNextString()
    image = gd.getNextString()
    image = relpath(image, rootDir)
    print refBrain
    refBrain = relpath(refBrain, rootDir)
    print refBrain

    affine = gd.getNextBoolean()
    ch01 = gd.getNextBoolean()
    warp = gd.getNextBoolean()
    ch02 = gd.getNextBoolean()
    reformat = gd.getNextBoolean()
    ch03 = gd.getNextBoolean()
    munger_actions = ""