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." )
Ejemplo n.º 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
Ejemplo n.º 4
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 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)
Ejemplo n.º 6
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 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." )
Ejemplo n.º 9
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)
Ejemplo n.º 10
0
def getOptions():
	gui = GenericDialogPlus("Options for Moving TIFF files")
	gui.addMessage("Select the number of imput files to be used per stitched image")
	gui.addSlider("", 2, 10, 2)
	gui.addFileField("Select csv file", "")
	gui.addMessage("Add key values and corresponding genotype, when finished, leave fields empty")
	gui.addStringField("Key :", prefs.get(None, "key1", "p"))
	gui.addToSameRow()
	gui.addStringField("Genotype :", prefs.get(None, "genotype1", "PROM-1_HA"))
	gui.addStringField("Key :", prefs.get(None, "key2", "p"))
	gui.addToSameRow()
	gui.addStringField("Genotype :", prefs.get(None, "genotype2", "PROM-1_HA"))
	gui.addStringField("Key :", prefs.get(None, "key3", "p"))
	gui.addToSameRow()
	gui.addStringField("Genotype :", prefs.get(None, "genotype3", "PROM-1_HA"))
	gui.addStringField("Key :", prefs.get(None, "key4", "p"))
	gui.addToSameRow()
	gui.addStringField("Genotype :", prefs.get(None, "genotype4", "PROM-1_HA"))
	gui.addStringField("Key :", prefs.get(None, "key5", "p"))
	gui.addToSameRow()
	gui.addStringField("Genotype :", prefs.get(None, "genotype5", "PROM-1_HA"))
	gui.showDialog() 

	if gui.wasOKed():
		tiffs_per_image = int(gui.getNextNumber())
		csv_file = str(gui.getNextString())
		genotypes = {}
		for i in range(5):
			key = str(gui.getNextString())
			value = str(gui.getNextString())
			if key != "":
				genotypes[key] = value
	else:
		return
	if len(genotypes) > 0:
		a = list(genotypes.items())[0]
		prefs.put(None, "key1", a[0])
		prefs.put(None, "genotype1", a[1])
	if len(genotypes) > 1:
		a = list(genotypes.items())[1]
		prefs.put(None, "key2", a[0])
		prefs.put(None, "genotype2", a[1])
	if len(genotypes) > 2:
		a = list(genotypes.items())[2]
		prefs.put(None, "key3", a[0])
		prefs.put(None, "genotype3", a[1])
	if len(genotypes) > 3:
		a = list(genotypes.items())[3]
		prefs.put(None, "key4", a[0])
		prefs.put(None, "genotype4", a[1])
	if len(genotypes) > 4:
		a = list(genotypes.items())[4]
		prefs.put(None, "key5", a[0])
		prefs.put(None, "genotype5", a[1])
	return tiffs_per_image, csv_file, genotypes
Ejemplo n.º 11
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 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)
Ejemplo n.º 13
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()
rowNo = int(gd.getNextNumber())
colNo = int(gd.getNextNumber())
nucMinSize = int(gd.getNextNumber())
cmMinSize = int(gd.getNextNumber())
allFileNames = os.listdir(folderPath)
jsonStoreDict = {"folderPath": folderPath,
				"formatString":formatString,
				"groupBy": ','.join(groupBy),
				"nucChannel": nucChannel,
				"cmChannel": cmChannel,
				"stitched": stitched,
				"nucMethod": nucMethod,
				"analyzeNucStack": analyzeNucStack,
				"brightfield": brightfield,
				"cmMethod": cmMethod,
				"analyzeCmStack": analyzeCmStack,
Ejemplo n.º 14
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
Ejemplo n.º 15
0
	munger_actions+="-a "
if warp:
	munger_actions+="-w "
if reformat:
	channels=''
	if ch01:
		channels+='01'
	if ch02:
		channels+='02'
	if ch03:
		channels+='03'
	if channels != '':
		munger_actions+="-r "+channels+" "

verbose=gd.getNextBoolean()
corestouse=gd.getNextNumber()
outsuffix=gd.getNextString()
regparams=gd.getNextChoice()
print regparams
regparams=gd.getNextString()
mungeropts=gd.getNextString()
action=gd.getNextChoice()

if action == 'Test': mungeropts+=' -t'
if verbose: mungeropts+=' -v'
mungeropts+=' -T %d' % (int(corestouse))

if not outsuffix == '':
	mungeropts += ' -d .'+outsuffix

cmd='"%s" -b "%s" %s %s %s -s "%s" %s' % (munger,bindir,munger_actions,regparams,mungeropts,refBrain,image)
Ejemplo n.º 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
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
    b2 = 0.2493
    a3 = -0.09975
Ejemplo n.º 17
0
    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 +
                                               "Fiji_Analysis"):
    gdchk = GenericDialog("WARNING")
    gdchk.addMessage(
        "Analysis folder already exists. Choose a different directory to avoid overwritng your current data"
    )
    gdchk.hideCancelButton()
Ejemplo n.º 18
0
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")

Ejemplo n.º 19
0
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)
    prefs.put("Angles", angles)
    prefs.put("Method", method)
Ejemplo n.º 20
0
        munger_actions += "-a "
    if warp:
        munger_actions += "-w "
    if reformat:
        channels = ''
        if ch01:
            channels += '01'
        if ch02:
            channels += '02'
        if ch03:
            channels += '03'
        if channels != '':
            munger_actions += "-r " + channels + " "

    verbose = gd.getNextBoolean()
    corestouse = gd.getNextNumber()
    outsuffix = gd.getNextString()
    regparams = gd.getNextChoice()
    print regparams
    regparams = gd.getNextString()
    mungeropts = gd.getNextString()
    action = gd.getNextChoice()

    if action == 'Test': mungeropts += ' -t'
    if verbose: mungeropts += ' -v'
    mungeropts += ' -T %d' % (int(corestouse))

    if not outsuffix == '':
        mungeropts += ' -d .' + outsuffix

    cmd = '"%s" -b "%s" %s %s %s -s "%s" %s' % (