import ij.IJ; import ij.ImagePlus; import ij.gui.DialogListener; import ij.gui.GenericDialog; import ij.gui.NonBlockingGenericDialog; import ij.gui.ImagePanel; import ij.io.OpenDialog; import ij.macro.MacroRunner; import ij.plugin.PlugIn; import ij.util.Tools; import java.awt.AWTEvent; import java.awt.Button; import java.awt.Checkbox; import java.awt.Choice; import java.awt.Color; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Label; import java.awt.Panel; import java.awt.Scrollbar; import java.awt.TextField; import java.awt.Toolkit; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.net.URL; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Vector; import java.util.Arrays; /** JEasyTFM version 2.1 JEasyTFM is an open-source ImageJ plugins package aimed for the automatic analysis of large Traction Force Microscopy kinetic images data. This package able the automatic analysis of TFM data in time lapse with: - 1 to 2 beads channels (i.e. with two different beads colors) - 1 to 3 cells channels (for example with Bright Field, GFP and Hoechst channels) - multi-positions (i.e. several sample positions within a given experiment) - calculation of the traction forces - automatic cells segmentation carried out from their BF images - integration of the forces over the cells - tracking of the beads - focal adhesion segmentations - calculation of the traction forces applied on the focal adhesions - batch-processing using jobs creation, launching and tracking This plugin generates the "JEasyTFM.txt". i.e. the configuration file needed to launch traction force analysis methods. Author: Philippe Carl (Philippe DOT Carl AT unistra DOT fr) Requires: ImageJ 1.53d47 or later History: 2020/07/31: Version 1.0 - First released version: The analysis package is made available for the community. 2023/01/23: Version 2.0 - Extension of the code to allow the calculation of the traction forces applied on the focal adhesions. 2023/02/23: Version 2.1 - For the particle_tracker feature JEasyTFM uses now the 1.0.25 version of the MosaicSuite code released on 20 September 2022 (instead of the 1.5. version of the Particle_Tracker code released September 2006) 2023/06/18: Version 2.2 - Addition of tooltips within the Create_job window (the addition of this feature required the 1.54f11 update of ImageJ). **/ /** Copyright (C) 2020 Philippe Carl. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ public class create_job implements PlugIn, DialogListener, FocusListener, MouseListener, MouseWheelListener { String config_file; // GenericDialog gd; NonBlockingGenericDialog gd; URL url = null; Image icon = null, image = null; ImagePlus imp; Component comp; GridBagLayout grid; GridBagConstraints cst; Vector TextFields; boolean boFolder, boFile1, boFile2; String folder, file1, file2, str; String linkRoot = "http://questpharma.u-strasbg.fr/"; // String linkRoot = "http://punias.free.fr/ImageJ/"; String helpURL, helpMacro; TextField tfFolder, tfFile1, tfFile2; boolean underscrore = true; String link = underscrore ? "_-_" : " - "; boolean debug; int objective_magnification, slices, frames, frames_begin, cells_number, beads, ch, image_chosen; double camera_pixel_size; boolean beads1, beads2; boolean ch1 , ch2 , ch3 ; boolean mod1, mod2, mod3; boolean cells_images , beads_reference_images , beads_sequence_images , traction_force , traction_high_force , cells_analysis , FA_segmentation , traction_force_applied_on_FA; boolean beads_reference_images_find_focused_slices , beads_sequence_images_find_focused_slices , traction_high_enhance_constrast; int cells_starting_folder, cells_ending_folder, beads_reference_starting_folder, beads_reference_ending_folder, beads_sequence_starting_folder, beads_sequence_ending_folder, traction_starting_folder, traction_ending_folder, traction_high_starting_folder , traction_high_ending_folder, cells_analysis_starting_folder, cells_analysis_ending_folder, FA_segmentation_starting_folder, FA_segmentation_ending_folder, traction_applied_on_FA_starting_folder, traction_applied_on_FA_ending_folder; Button okButton; ImagePanel [] imagePanels; Component [] dlgItems; Checkbox [] checkboxes; Choice [] choices; Scrollbar [] scrollbars; TextField [] scrollTFds; private static int numberCh; private static String [] numberChText = { "1", "2", "3"}; private static String E; private static int EIndex; // index of initial selected Young's modulus value in dropdown menu private static String [] EArray = { " 1500", " 4000", " 7000", "10000", "17000"}; private static double precisionForLambda; private static String precisionForLambdaAsText; private static int precisionForLambdaIndex; // index of initial selected precision for the lambda value calculation in dropdown menu private static String [] precisionForLambdaArray = { "0.5", "0.1", "0.05", "0.01", "0.005", "0.001", "0.0005", "0.0001"}; private static double [] precisionForLambdaValues = { 0.5 , 0.1 , 0.05 , 0.01 , 0.005 , 0.001 , 0.0005 , 0.0001 }; boolean traction_force_alignment, traction_force_alignment_make, traction_force_alignment_crop, traction_force_calculation, piv_calculation, lambda_calculation, force_calculation, force_superposition; boolean high_piv_calculation, particle_tracker; boolean cells_segmentation, cells_selection, force_integration; int val; int i; File file; String [] list; int [] xOffset = new int[] { 0, 0, 1, 0, 1, 2, 0, 1, 2, 0, 0, 2, 0, 2, 0, 2, 3, 3, 2, 3, 3, 3, 3, 0, 2, 2, 2, 0, 2, 2, 2, 0, 0}; // int [] xOffset = new int[] { 0, 0, 1, 0, 1, 2, 0, 0, 2, 0, 2, 0, 2, 3, 3, 2, 3, 3, 3, 0, 2, 2, 2, 0, 2, 2, 2}; // int [] yOffset = new int[] {-3, 0,-1, 0,-1,-2, 0, 0,-1, 0,-1, 0,-2,-3,-3,-3,-4,-4,-4, 0,-1,-2,-2, 0,-2,-2,-2}; int [] yOffset = new int[] {-6, 0,-1, 0,-1,-2, 0,-1,-2, 0, 0,-1, 0,-1, 0,-2,-3,-3,-3,-4,-4,-4,-4, 0,-1,-3,-2, 0,-1,-2,-2, 0, 0}; public void run(String arg) { try { url = getClass().getResource("/image/JEasyTFM.ico"); icon = Toolkit.getDefaultToolkit().getImage(url); } catch (Exception e) { IJ.showMessage("Loading the icon image", "The icon image \"/image/JEasyTFM.ico\" could not be found!"); } if (arg.equals("about")) { showAbout(); return; } if (IJ.versionLessThan("1.53d")) return; config_file = IJ.getDirectory("plugins") + "JEasyTFM.txt"; if(!showDialog(setData(readData(config_file)))) return; } private String [] readData(String parameters_file) { String [] data = {"false"}; String [] columns; file = new File(parameters_file); if (!file.exists()) { // IJ.log("File not found"); } else { try { String config = IJ.openAsString(parameters_file); String [] lines = Tools.split(config ,"\n"); data = new String[lines.length]; for(int i = 0; i != lines.length; i++) { columns = Tools.split(lines[i],"\t"); data[i] = columns[1]; } } catch (Exception e) { // IJ.log("File open error \n\"" + e.getMessage() + "\"\n"); } } return data; } private boolean setData(String[] str_config_data) { if(str_config_data.length == 56) { i = 0; camera_pixel_size = Double.parseDouble ( str_config_data[i++] ); objective_magnification = Integer.parseInt ( str_config_data[i++] ); debug = Boolean.parseBoolean ( str_config_data[i++] ); folder = str_config_data[i++] ; file1 = str_config_data[i++] ; file2 = str_config_data[i++] ; cells_number = Integer.parseInt ( str_config_data[i++] ); slices = Integer.parseInt ( str_config_data[i++] ); frames = Integer.parseInt ( str_config_data[i++] ); frames_begin = Integer.parseInt ( str_config_data[i++] ); beads = Integer.parseInt ( str_config_data[i++] ); ch = Integer.parseInt ( str_config_data[i++] ); numberCh = Integer.parseInt ( str_config_data[i++] ); E = str_config_data[i++] ; precisionForLambdaAsText = str_config_data[i++] ; cells_images = Boolean.parseBoolean ( str_config_data[i++] ); image_chosen = Integer.parseInt ( str_config_data[i++] ); cells_starting_folder = Integer.parseInt ( str_config_data[i++] ); cells_ending_folder = Integer.parseInt ( str_config_data[i++] ); beads_reference_images = Boolean.parseBoolean ( str_config_data[i++] ); beads_reference_images_find_focused_slices = Boolean.parseBoolean ( str_config_data[i++] ); beads_reference_starting_folder = Integer.parseInt ( str_config_data[i++] ); beads_reference_ending_folder = Integer.parseInt ( str_config_data[i++] ); beads_sequence_images = Boolean.parseBoolean ( str_config_data[i++] ); beads_sequence_images_find_focused_slices = Boolean.parseBoolean ( str_config_data[i++] ); beads_sequence_starting_folder = Integer.parseInt ( str_config_data[i++] ); beads_sequence_ending_folder = Integer.parseInt ( str_config_data[i++] ); traction_force = Boolean.parseBoolean ( str_config_data[i++] ); traction_starting_folder = Integer.parseInt ( str_config_data[i++] ); traction_ending_folder = Integer.parseInt ( str_config_data[i++] ); traction_force_alignment = Boolean.parseBoolean ( str_config_data[i++] ); traction_force_alignment_make = Boolean.parseBoolean ( str_config_data[i++] ); traction_force_alignment_crop = Boolean.parseBoolean ( str_config_data[i++] ); traction_force_calculation = Boolean.parseBoolean ( str_config_data[i++] ); piv_calculation = Boolean.parseBoolean ( str_config_data[i++] ); lambda_calculation = Boolean.parseBoolean ( str_config_data[i++] ); force_calculation = Boolean.parseBoolean ( str_config_data[i++] ); force_superposition = Boolean.parseBoolean ( str_config_data[i++] ); cells_analysis = Boolean.parseBoolean ( str_config_data[i++] ); cells_analysis_starting_folder = Integer.parseInt ( str_config_data[i++] ); cells_analysis_ending_folder = Integer.parseInt ( str_config_data[i++] ); cells_segmentation = Boolean.parseBoolean ( str_config_data[i++] ); cells_selection = Boolean.parseBoolean ( str_config_data[i++] ); force_integration = Boolean.parseBoolean ( str_config_data[i++] ); traction_high_force = Boolean.parseBoolean ( str_config_data[i++] ); traction_high_enhance_constrast = Boolean.parseBoolean ( str_config_data[i++] ); traction_high_starting_folder = Integer.parseInt ( str_config_data[i++] ); traction_high_ending_folder = Integer.parseInt ( str_config_data[i++] ); high_piv_calculation = Boolean.parseBoolean ( str_config_data[i++] ); particle_tracker = Boolean.parseBoolean ( str_config_data[i++] ); FA_segmentation = Boolean.parseBoolean ( str_config_data[i++] ); FA_segmentation_starting_folder = Integer.parseInt ( str_config_data[i++] ); FA_segmentation_ending_folder = Integer.parseInt ( str_config_data[i++] ); traction_force_applied_on_FA = Boolean.parseBoolean ( str_config_data[i++] ); traction_applied_on_FA_starting_folder = Integer.parseInt ( str_config_data[i++] ); traction_applied_on_FA_ending_folder = Integer.parseInt ( str_config_data[i++] ); beads1 = (beads & 0x1) != 0; beads2 = (beads & 0x2) != 0; ch1 = (ch & 0x1) != 0; ch2 = (ch & 0x2) != 0; ch3 = (ch & 0x4) != 0; mod1 = (ch & 0x10) != 0; mod2 = (ch & 0x20) != 0; mod3 = (ch & 0x40) != 0; EIndex = Arrays.asList(EArray).indexOf(E) >= 0 ? Arrays.asList(EArray).indexOf(E) : 1; precisionForLambdaIndex = getIndex(precisionForLambdaValues, Double.parseDouble(precisionForLambdaAsText)); folder = folder.replace("/" , File.separator); folder = folder.replace("\\", File.separator); return true; } else { // IJ.log("The configuration file is empty"); folder = "**** Please Drag&Drop here the folder where you saved your temporal images ****"; file1 = "This field will be automatically filled out upon selection of the \"Data folder\" field "; file2 = "This field will be automatically filled out upon selection of the \"Data folder\" field "; camera_pixel_size = 6.5; // 6.5µm is the size of the Hamamatsu ORCA-Flash4.0 V2 cell size (https://www.hamamatsu.com/resources/pdf/sys/SCAS0081E_C11440-22CU.pdf) objective_magnification = 60; // 60 corresponds to an 60x objective magnification EIndex = 4; precisionForLambdaIndex = 1; precisionForLambda = 0.001; cells_number = 30; slices = 14; frames = 48; numberCh = 1; frames_begin = 1; cells_starting_folder = 19; cells_ending_folder = 19; beads_reference_starting_folder = 19; beads_reference_ending_folder = 19; beads_sequence_starting_folder = 19; beads_sequence_ending_folder = 19; traction_starting_folder = 19; traction_ending_folder = 19; traction_high_starting_folder = 1; traction_high_ending_folder = 10; cells_analysis_starting_folder = 1; cells_analysis_ending_folder = 10; FA_segmentation_starting_folder = 1; FA_segmentation_ending_folder = 10; traction_applied_on_FA_starting_folder = 1; traction_applied_on_FA_ending_folder = 10; debug = false; cells_images = true; beads_reference_images = true; beads_sequence_images = true; traction_force = true; traction_force_alignment = true; traction_force_alignment_make = true; traction_force_alignment_crop = true; traction_force_calculation = true; piv_calculation = true; lambda_calculation = true; force_calculation = true; force_superposition = true; cells_analysis = false; cells_segmentation = false; cells_selection = false; force_integration = false; traction_high_force = false; traction_high_enhance_constrast = false; high_piv_calculation = false; particle_tracker = false; FA_segmentation = false; traction_force_applied_on_FA = false; return false; } } private int getIndex(double[] array, double value) { for(int i = 0; i != array.length; i++) if(value == array[i]) return i; return -1; } private boolean showDialog(boolean dataFromFile) { // gd = new GenericDialog ("JEasyTFM - Create job"); // gd = new GenericDialog ("JEasyTFM - Output files"); gd = new NonBlockingGenericDialog ("JEasyTFM - Create job"); // gd = new NonBlockingGenericDialog ("JEasyTFM - Output files"); gd.setIconImage (icon); try { url = getClass().getResource("/image/question-button-icon.png"); image = Toolkit.getDefaultToolkit().getImage(url); imp = new ImagePlus("Error message", image); } catch (Exception e) { IJ.showMessage("Loading the insert image", "The image \"/image/question-button-icon.png\" could not be found!"); } imagePanels = new ImagePanel[11]; for (i = 0; i != imagePanels.length; i++) { ImagePanel imagePanel = new ImagePanel(imp); imagePanel.addMouseListener(this); imagePanels[i] = imagePanel; } gd.addDirectoryField ("Data_folder" , folder, 82); // 0 - 1 gd.addPanel (imagePanels[ 0]); // 2 gd.addFileField ("Sequence images" , file1 , 82); // 3 - 4 gd.addPanel (imagePanels[ 1]); // 5 gd.addFileField ("Reference images" , file2 , 82); // 6 - 7 gd.addPanel (imagePanels[ 2]); // 8 gd.addCheckbox ("Debug" , debug); // 9 0 gd.addSlider ("Number_of_acquired_cells" , 1, 30, cells_number); // 10 - 11 gd.addSlider ("Slices" , 1, 60, slices); // 12 - 13 gd.addSlider ("Frames" , 1, 200, frames); // 14 - 15 gd.addToSameRow (); gd.addSlider ("Frames_begin" , 1, frames, frames_begin); // 16 - 17 gd.addCheckbox ("Beads1" , beads1); // 18 1 gd.addCheckbox ("Beads2" , beads2); // 19 2 gd.addCheckbox ("Ch1" , ch1); // 20 3 gd.addCheckbox ("Ch2" , ch2); // 21 4 gd.addCheckbox ("Ch3" , ch3); // 22 5 gd.addChoice ("______________________Number of Ch" , numberChText, numberChText[numberCh - 1]); // 23 - 24 gd.addCheckbox ("Kurto1" , mod1); // 25 6 gd.addCheckbox ("Kurto2" , mod2); // 26 7 gd.addCheckbox ("Kurto3" , mod3); // 27 8 gd.addChoice ("Young's_modulus_(Pa)" , EArray , EArray[EIndex]); // 28 - 29 gd.addToSameRow(); gd.addChoice ("Precision_for_the_regularization_factor_calculation_(Pa)" , precisionForLambdaArray, precisionForLambdaArray[precisionForLambdaIndex]); // 30 - 31 // gd.addMessage ("\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af\u00af"); // gd.addMessage (""); gd.addCheckbox ("Cells_images" , cells_images); // 32 9 gd.addToSameRow (); gd.addPanel (imagePanels[ 3]); // 33 // gd.addImage (imp); // 33 // gd.addToSameRow (); gd.addSlider ("Image_chosen_from_slices" , 0, slices , image_chosen); // 34 - 35 gd.addSlider (" Cells_starting_folder" , 1, cells_number, cells_starting_folder); // 36 - 37 gd.addSlider (" Cells_ending_folder" , 1, cells_number, cells_ending_folder ); // 38 - 39 gd.addCheckbox ("Beads_reference_images" , beads_reference_images); // 40 10 gd.addToSameRow (); gd.addPanel (imagePanels[ 4]); // 41 // gd.addToSameRow (); gd.addCheckbox ("Beads_reference_images_find_focused_slices" , beads_reference_images_find_focused_slices); // 42 11 gd.addSlider (" Beads_reference_starting_folder" , 1, cells_number, beads_reference_starting_folder); // 43 - 44 gd.addSlider (" Beads_reference_ending_folder" , 1, cells_number, beads_reference_ending_folder ); // 45 - 46 gd.addCheckbox ("Beads_sequence_images" , beads_sequence_images); // 47 12 gd.addToSameRow (); gd.addPanel (imagePanels[ 5]); // 48 gd.addCheckbox ("Beads_sequence_images_find_focused_slices" , beads_sequence_images_find_focused_slices); // 49 13 gd.addSlider (" Beads_sequence_starting_folder" , 1, cells_number, beads_sequence_starting_folder); // 50 - 51 gd.addSlider (" Beads_sequence_ending_folder" , 1, cells_number, beads_sequence_ending_folder ); // 52 - 53 gd.addCheckbox ("Traction_force" , traction_force); // 54 14 gd.addToSameRow (); gd.addPanel (imagePanels[ 6]); // 55 gd.addSlider (" Traction_starting_folder" , 1, cells_number, traction_starting_folder); // 56 - 57 gd.addSlider (" Traction_ending_folder" , 1, cells_number, traction_ending_folder); // 58 - 59 gd.addCheckbox ("Traction_force_alignment" , traction_force_alignment); // 60 15 gd.addCheckbox ("Alignment_make" , traction_force_alignment_make); // 61 16 gd.addCheckbox ("Alignment_crop" , traction_force_alignment_crop); // 62 17 gd.addCheckbox ("Traction_force_calculation" , traction_force_calculation); // 63 18 gd.addCheckbox ("PIV__________calculation" , piv_calculation); // 64 19 gd.addCheckbox ("Lambda_calculation" , lambda_calculation); // 65 20 gd.addCheckbox ("Force______calculation" , force_calculation); // 66 21 gd.addCheckbox ("Force_superposition" , force_superposition); // 67 22 gd.addCheckbox ("Cells_analysis" , cells_analysis); // 68 23 gd.addToSameRow (); gd.addPanel (imagePanels[ 7]); // 69 gd.addSlider (" Cells_analysis_starting_folder" , 1, cells_number, cells_analysis_starting_folder); // 70 - 71 gd.addSlider (" Cells_analysis_ending_folder" , 1, cells_number, cells_analysis_ending_folder); // 72 - 73 gd.addCheckbox ("cells_segmentation" , cells_segmentation); // 74 24 gd.addCheckbox ("Cells_selection_(manual_user_step)" , cells_selection); // 75 25 gd.addCheckbox ("Force_integration" , force_integration); // 76 26 gd.addCheckbox ("Traction_high_force" , traction_high_force); // 77 27 gd.addToSameRow (); gd.addPanel (imagePanels[ 8]); // 78 gd.addCheckbox ("Traction_high_enhance_constrast" , traction_high_enhance_constrast); // 79 28 gd.addSlider (" Traction_high_starting_folder" , 1, cells_number, traction_high_starting_folder); // 80 - 81 gd.addSlider (" Traction_high_ending_folder" , 1, cells_number, traction_high_ending_folder); // 82 - 83 gd.addCheckbox ("High_PIV_calculation" , high_piv_calculation); // 84 29 gd.addCheckbox ("Particle_tracker" , particle_tracker); // 85 30 gd.addCheckbox ("FA_segmentation_(manual_user_step)" , FA_segmentation); // 86 31 gd.addToSameRow (); gd.addPanel (imagePanels[ 9]); // 87 gd.addSlider (" FA_segmentation_starting_folder" , 1, cells_number, FA_segmentation_starting_folder); // 88 - 89 gd.addSlider (" FA_segmentation_ending_folder" , 1, cells_number, FA_segmentation_ending_folder); // 90 - 91 gd.addCheckbox ("Traction_force_applied_on_FA" , traction_force_applied_on_FA); // 92 32 gd.addToSameRow (); gd.addPanel (imagePanels[10]); // 93 gd.addSlider (" Traction_applied_on_FA_starting_folder" , 1, cells_number, traction_applied_on_FA_starting_folder); // 94 - 95 gd.addSlider (" Traction_applied_on_FA_ending_folder" , 1, cells_number, traction_applied_on_FA_ending_folder); // 96 - 97 gd.setOKLabel ("Generate file and Exit"); checkboxes = (Checkbox []) (gd.getCheckboxes ().toArray(new Checkbox [gd.getCheckboxes ().size()])); choices = (Choice []) (gd.getChoices ().toArray(new Choice [gd.getChoices ().size()])); scrollbars = (Scrollbar[]) (gd.getSliders ().toArray(new Scrollbar[gd.getSliders ().size()])); scrollTFds = (TextField[]) (gd.getNumericFields().toArray(new TextField[gd.getNumericFields().size()])); grid = (GridBagLayout) gd.getLayout(); for(i = 0; i != xOffset.length; i++) { // comp = (Component) gd.getCheckboxes().get(i); // cst = grid.getConstraints(comp); cst = grid.getConstraints(checkboxes[i]); cst.gridx = cst.gridx + xOffset[i]; cst.gridy = cst.gridy + yOffset[i]; // grid.setConstraints(comp, cst); grid.setConstraints(checkboxes[i], cst); } TextFields = gd.getStringFields(); tfFolder = (TextField) (TextFields.elementAt(0)); tfFile1 = (TextField) (TextFields.elementAt(1)); tfFile2 = (TextField) (TextFields.elementAt(2)); for (int i = 0; i < scrollbars.length; i++) { scrollbars[i].addMouseWheelListener (this); scrollTFds[i].addMouseWheelListener (this); scrollbars[i].addFocusListener (this); scrollTFds[i].addFocusListener (this); } // for (int i = 3; i < 6; i++) // checkboxes[i].setEnabled( false ); dlgItems = gd.getComponents(); okButton = gd.getButtons()[0]; if (dataFromFile) { boFolder = true; boFile1 = true; boFile2 = true; } else { tfFolder.setBackground(Color.GREEN); boFolder = false; boFile1 = false; boFile2 = false; okButton.setEnabled( false ); } // Data folder cst = grid.getConstraints(dlgItems[2]); cst.gridx = cst.gridx + 4; cst.gridy = cst.gridy - 1; grid.setConstraints(dlgItems[2], cst); // File cst = grid.getConstraints(dlgItems[5]); cst.gridx = cst.gridx + 4; cst.gridy = cst.gridy - 1; grid.setConstraints(dlgItems[5], cst); // Reference images cst = grid.getConstraints(dlgItems[8]); cst.gridx = cst.gridx + 4; cst.gridy = cst.gridy - 1; grid.setConstraints(dlgItems[8], cst); // Number of Ch cst = grid.getConstraints(dlgItems[23]); cst.gridx = cst.gridx + 2; cst.gridy = cst.gridy - 3; grid.setConstraints(dlgItems[23], cst); cst = grid.getConstraints(dlgItems[24]); cst.gridx = cst.gridx + 4; cst.gridy = cst.gridy - 3; grid.setConstraints(dlgItems[24], cst); // Image chosen from slices cst = grid.getConstraints(dlgItems[34]); cst.gridx = cst.gridx + 2; cst.gridy = cst.gridy - 1; grid.setConstraints(dlgItems[34], cst); cst = grid.getConstraints(dlgItems[35]); cst.gridx = cst.gridx + 4; cst.gridy = cst.gridy - 1; grid.setConstraints(dlgItems[35], cst); // dlgItems[ 3].setEnabled( false ); // dlgItems[16].setVisible( false ); // choices[0].setVisible(false); /* // for(i = 0; i != dlgItems.length; i++) for(i = 9; i != 32; i++) dlgItems[i].setEnabled( false ); for(i = 34; i != 40; i++) dlgItems[i].setEnabled( false ); for(i = 42; i != 47; i++) dlgItems[i].setEnabled( false ); for(i = 49; i != 53; i++) dlgItems[i].setEnabled( false ); for(i = 56; i != 59; i++) dlgItems[i].setEnabled( false ); for(i = 70; i != 74; i++) dlgItems[i].setEnabled( false ); for(i = 79; i != 84; i++) dlgItems[i].setEnabled( false ); for(i = 88; i != 91; i++) dlgItems[i].setEnabled( false ); for(i = 94; i != 98; i++) dlgItems[i].setEnabled( false ); // disabling all scrollbars for (int i = 0; i < scrollbars.length; i++) { scrollbars[i].setEnabled(false); scrollTFds[i].setEnabled(false); } /* // disabling all TextFields tfFolder .setEnabled(false); tfFile1 .setEnabled(false); tfFile2 .setEnabled(false); // disabling some checkBoxes boolean[] choicesEnable = new boolean[] { false, false }; for(i = 0; i != choicesEnable.length; i++) { comp = (Component) gd.getChoices().get(i); comp .setEnabled(choicesEnable[i]); } // disabling some checkBoxes boolean[] checkBoxesEnable = new boolean[] { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }; for(i = 0; i != checkBoxesEnable.length; i++) { comp = (Component) gd.getCheckboxes().get(i); comp .setEnabled(checkBoxesEnable[i]); } */ if(choices[0].getSelectedIndex() == 0) { if(!checkboxes[4].getState() && !checkboxes[5].getState()) checkboxes[4].setVisible(false); if(!checkboxes[5].getState()) checkboxes[5].setVisible(false); } if(choices[0].getSelectedIndex() == 1) if(!checkboxes[5].getState()) checkboxes[5].setVisible(false); checkboxes[6].setVisible(checkboxes[3].getState()); checkboxes[7].setVisible(checkboxes[4].getState()); checkboxes[8].setVisible(checkboxes[5].getState()); if(!checkboxes[9].getState()) // Cells images for (i = 34; i < 40; i++ ) // Images chosen from slices dlgItems[i].setVisible(false); if(!checkboxes[10].getState()) // Beads reference images for (i = 42; i < 47; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[12].getState()) // Beads sequence images for (i = 49; i < 54; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[14].getState()) // Traction force for (i = 56; i < 68; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[15].getState()) // Traction force alignment { for (i = 61; i < 63; i++ ) dlgItems[i].setVisible(false); for(i = 16; i != 22; i++) { cst = grid.getConstraints(checkboxes[i]); cst.gridy--; grid.setConstraints(checkboxes[i], cst); } } if(!checkboxes[18].getState()) // Traction force calculation for (i = 64; i < 68; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[23].getState()) // Cells analysis for (i = 70; i < 77; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[27].getState()) // Traction high force for (i = 79; i < 86; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[31].getState()) // FA_segmentation for (i = 88; i < 92; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[32].getState()) // traction_force_applied_on_FA for (i = 94; i < 98; i++ ) dlgItems[i].setVisible(false); gd.pack (); gd.addDialogListener (this); gd.showDialog (); if (gd.wasCanceled()) return false; debug = gd.getNextBoolean(); folder = gd.getNextString (); file1 = gd.getNextString (); file2 = gd.getNextString (); cells_number = (int) gd.getNextNumber (); slices = (int) gd.getNextNumber (); frames = (int) gd.getNextNumber (); frames_begin = (int) gd.getNextNumber (); beads1 = gd.getNextBoolean(); beads2 = gd.getNextBoolean(); ch1 = gd.getNextBoolean(); ch2 = gd.getNextBoolean(); ch3 = gd.getNextBoolean(); mod1 = gd.getNextBoolean(); mod2 = gd.getNextBoolean(); mod3 = gd.getNextBoolean(); numberCh = gd.getNextChoiceIndex() + 1; EIndex = gd.getNextChoiceIndex(); E = EArray[EIndex]; precisionForLambdaIndex = gd.getNextChoiceIndex(); precisionForLambda = Double.parseDouble( precisionForLambdaArray[precisionForLambdaIndex]); cells_images = gd.getNextBoolean(); image_chosen = (int) gd.getNextNumber (); cells_starting_folder = (int) gd.getNextNumber (); cells_ending_folder = (int) gd.getNextNumber (); beads_reference_images = gd.getNextBoolean(); beads_reference_images_find_focused_slices = gd.getNextBoolean(); beads_reference_starting_folder = (int) gd.getNextNumber (); beads_reference_ending_folder = (int) gd.getNextNumber (); beads_sequence_images = gd.getNextBoolean(); beads_sequence_images_find_focused_slices = gd.getNextBoolean(); beads_sequence_starting_folder = (int) gd.getNextNumber (); beads_sequence_ending_folder = (int) gd.getNextNumber (); traction_force = gd.getNextBoolean(); traction_starting_folder = (int) gd.getNextNumber (); traction_ending_folder = (int) gd.getNextNumber (); traction_force_alignment = gd.getNextBoolean(); traction_force_alignment_make = gd.getNextBoolean(); traction_force_alignment_crop = gd.getNextBoolean(); traction_force_calculation = gd.getNextBoolean(); piv_calculation = gd.getNextBoolean(); lambda_calculation = gd.getNextBoolean(); force_calculation = gd.getNextBoolean(); force_superposition = gd.getNextBoolean(); cells_analysis = gd.getNextBoolean(); cells_analysis_starting_folder = (int) gd.getNextNumber (); cells_analysis_ending_folder = (int) gd.getNextNumber (); cells_segmentation = gd.getNextBoolean(); cells_selection = gd.getNextBoolean(); force_integration = gd.getNextBoolean(); traction_high_force = gd.getNextBoolean(); traction_high_enhance_constrast = gd.getNextBoolean(); traction_high_starting_folder = (int) gd.getNextNumber (); traction_high_ending_folder = (int) gd.getNextNumber (); high_piv_calculation = gd.getNextBoolean(); particle_tracker = gd.getNextBoolean(); FA_segmentation = gd.getNextBoolean(); FA_segmentation_starting_folder = (int) gd.getNextNumber (); FA_segmentation_ending_folder = (int) gd.getNextNumber (); traction_force_applied_on_FA = gd.getNextBoolean(); traction_applied_on_FA_starting_folder = (int) gd.getNextNumber (); traction_applied_on_FA_ending_folder = (int) gd.getNextNumber (); folder = folder.endsWith(File.separator) ? folder : folder + File.separator; beads = beads1 ? 0x1 : 0; beads = beads2 ? beads + 0x2 : beads; ch = ch1 ? 0x1 : 0; ch = ch2 ? ch + 0x2 : ch; ch = ch3 ? ch + 0x4 : ch; ch = mod1 ? ch + 0x10 : ch; ch = mod2 ? ch + 0x20 : ch; ch = mod3 ? ch + 0x40 : ch; try { FileOutputStream fos = new FileOutputStream (config_file); BufferedOutputStream bos = new BufferedOutputStream (fos); PrintWriter writer = new PrintWriter (bos); writer.println("camera_pixel_size\t" + camera_pixel_size); writer.println("objective_magnification\t" + objective_magnification); writer.println("debug\t" + debug); writer.println("folder\t" + folder); writer.println("file1\t" + file1); writer.println("file2\t" + file2); writer.println("cells_number\t" + cells_number); writer.println("slices\t" + slices); writer.println("frames\t" + frames); writer.println("frames_begin\t" + frames_begin); writer.println("beads\t" + beads); writer.println("channel\t" + ch); writer.println("number of acquired channels\t" + numberCh); writer.println("Young's_modulus_(in_Pascal)\t" + E); writer.println("precision for regularization_factor\t" + precisionForLambda); writer.println("cells_images\t" + cells_images); writer.println("image_chosen\t" + image_chosen); writer.println("cells_starting_folder\t" + cells_starting_folder); writer.println("cells_ending_folder\t" + cells_ending_folder); writer.println("beads_reference_images\t" + beads_reference_images); writer.println("beads_reference_images_find_focused_slices\t" + beads_reference_images_find_focused_slices); writer.println("beads_reference_starting_folder\t" + beads_reference_starting_folder); writer.println("beads_reference_ending_folder\t" + beads_reference_ending_folder); writer.println("beads_sequence_images\t" + beads_sequence_images); writer.println("beads_sequence_images_find_focused_slices\t" + beads_sequence_images_find_focused_slices); writer.println("beads_sequence_starting_folder\t" + beads_sequence_starting_folder); writer.println("beads_sequence_ending_folder\t" + beads_sequence_ending_folder); writer.println("traction_force\t" + traction_force); writer.println("traction_starting_folder\t" + traction_starting_folder); writer.println("traction_ending_folder\t" + traction_ending_folder); writer.println("traction_force_alignment\t" + traction_force_alignment); writer.println("traction_force_alignment_make\t" + traction_force_alignment_make); writer.println("traction_force_alignment_crop\t" + traction_force_alignment_crop); writer.println("traction_force_calculation\t" + traction_force_calculation); writer.println("piv_calculation\t" + piv_calculation); writer.println("lambda_calculation\t" + lambda_calculation); writer.println("force_calculation\t" + force_calculation); writer.println("force_superposition\t" + force_superposition); writer.println("cells_analysis\t" + cells_analysis); writer.println("cells_analysis_starting_folder\t" + cells_analysis_starting_folder); writer.println("cells_analysis_ending_folder\t" + cells_analysis_ending_folder); writer.println("cells_segmentation\t" + cells_segmentation); writer.println("cells_selection\t" + cells_selection); writer.println("force_integration\t" + force_integration); writer.println("traction_high_force\t" + traction_high_force); writer.println("traction_high_enhance_constrast\t" + traction_high_enhance_constrast); writer.println("traction_high_starting_folder\t" + traction_high_starting_folder); writer.println("traction_high_ending_folder\t" + traction_high_ending_folder); writer.println("high_piv_calculation\t" + high_piv_calculation); writer.println("particle_tracker\t" + particle_tracker); writer.println("FA_segmentation\t" + FA_segmentation); writer.println("FA_segmentation_starting_folder\t" + FA_segmentation_starting_folder); writer.println("FA_segmentation_ending_folder\t" + FA_segmentation_ending_folder); writer.println("traction_force_applied_on_FA\t" + traction_force_applied_on_FA); writer.println("traction_applied_on_FA_starting_folder\t" + traction_applied_on_FA_starting_folder); writer.println("traction_applied_on_FA_ending_folder\t" + traction_applied_on_FA_ending_folder); writer.close(); } catch (IOException e) { IJ.log("File open error \n\"" + e.getMessage() + "\"\n"); return false; } return true; } public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) { int i; if (e != null && e.getSource() == checkboxes[3]) { checkboxes[6].setVisible(checkboxes[3].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[4]) { checkboxes[7].setVisible(checkboxes[4].getState()); if(checkboxes[4].getState()) if(choices[0].getSelectedIndex() < 1) choices[0].select(1); gd.pack(); } if (e != null && e.getSource() == checkboxes[5]) { checkboxes[8].setVisible(checkboxes[5].getState()); if(checkboxes[5].getState()) if(choices[0].getSelectedIndex() < 2) choices[0].select(2); gd.pack(); } if (e != null && e.getSource() == choices[0]) { if(choices[0].getSelectedIndex() == 0) { checkboxes[4].setState (false); checkboxes[5].setState (false); checkboxes[7].setState (false); checkboxes[8].setState (false); checkboxes[4].setVisible(false); checkboxes[5].setVisible(false); checkboxes[7].setVisible(false); checkboxes[8].setVisible(false); } else if(choices[0].getSelectedIndex() == 1) { checkboxes[5].setState (false); checkboxes[8].setState (false); checkboxes[4].setVisible(true); checkboxes[5].setVisible(false); checkboxes[8].setVisible(false); } else if(choices[0].getSelectedIndex() == 2) { checkboxes[4].setVisible(true); checkboxes[5].setVisible(true); } gd.pack(); } if (e != null && e.getSource() == checkboxes[9]) // Cells images { for (i = 34; i < 40; i++ ) // Images chosen from slices dlgItems[i].setVisible(checkboxes[9].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[10]) // Beads reference images { for (i = 42; i < 47; i++ ) dlgItems[i].setVisible(checkboxes[10].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[12]) // Beads sequence images { for (i = 49; i < 54; i++ ) dlgItems[i].setVisible(checkboxes[12].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[14]) // Traction force { for (i = 56; i < 68; i++ ) dlgItems[i].setVisible(checkboxes[14].getState()); if(checkboxes[14].getState()) { if(!checkboxes[15].getState()) // Traction force alignment for (i = 61; i < 63; i++ ) dlgItems[i].setVisible(false); if(!checkboxes[18].getState()) // Traction force calculation for (i = 64; i < 68; i++ ) dlgItems[i].setVisible(false); } gd.pack(); } if (e != null && e.getSource() == checkboxes[15]) // Traction force alignment { if(!checkboxes[15].getState()) { for (i = 61; i < 63; i++ ) dlgItems[i].setVisible(false); for(i = 16; i != 23; i++) { cst = grid.getConstraints(checkboxes[i]); cst.gridy--; grid.setConstraints(checkboxes[i], cst); } } else { for (i = 61; i < 63; i++ ) dlgItems[i].setVisible(true); for(i = 16; i != 23; i++) { cst = grid.getConstraints(checkboxes[i]); cst.gridy++; grid.setConstraints(checkboxes[i], cst); } } gd.pack(); } if (e != null && e.getSource() == checkboxes[18]) // Traction force calculation { for (i = 64; i < 68; i++ ) dlgItems[i].setVisible(checkboxes[18].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[23]) // Cells analysis { for (i = 70; i < 77; i++ ) dlgItems[i].setVisible(checkboxes[23].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[27]) // Traction high force { for (i = 79; i < 86; i++ ) dlgItems[i].setVisible(checkboxes[27].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[31]) // FA_segmentation { for (i = 88; i < 92; i++ ) dlgItems[i].setVisible(checkboxes[31].getState()); gd.pack(); } if (e != null && e.getSource() == checkboxes[32]) // Traction_force_applied_on_FA { for (i = 94; i < 98; i++ ) dlgItems[i].setVisible(checkboxes[32].getState()); gd.pack(); } if (e != null && (e.getSource() == scrollbars[0] || e.getSource() == scrollTFds[0])) { for (i = 5; i <= 20; i++) { scrollbars[i].setMaximum(scrollbars[0].getValue() + 1); if(Integer.parseInt(scrollTFds[i].getText()) > scrollbars[i].getMaximum() - 1) setSliderValue(i, scrollbars[i].getMaximum() - 1); } } if (e != null && (e.getSource() == scrollbars[1] || e.getSource() == scrollTFds[1])) { scrollbars[4].setMaximum(scrollbars[1].getValue() + 1); if(Integer.parseInt(scrollTFds[4].getText()) > Integer.parseInt(scrollTFds[1].getText())) scrollTFds[4].setText(scrollTFds[1].getText()); } if (e != null && (e.getSource() == scrollbars[2] || e.getSource() == scrollTFds[2])) { scrollbars[3].setMaximum(scrollbars[2].getValue() + 1); if(Integer.parseInt(scrollTFds[3].getText()) > Integer.parseInt(scrollTFds[1].getText())) scrollTFds[3].setText(scrollTFds[2].getText()); } for (i = 5; i <= 20; i = i + 2) { if (e != null && (e.getSource() == scrollbars[i ] || e.getSource() == scrollTFds[i ]) && (scrollbars[i ].getValue() > scrollbars[i + 1].getValue() || Integer.parseInt(scrollTFds[i ].getText()) > Integer.parseInt(scrollTFds[i + 1].getText()))) setSliderValue(i + 1, scrollbars[i ].getValue()); if (e != null && (e.getSource() == scrollbars[i + 1] || e.getSource() == scrollTFds[i + 1]) && (scrollbars[i + 1].getValue() < scrollbars[i ].getValue() || Integer.parseInt(scrollTFds[i + 1].getText()) < Integer.parseInt(scrollTFds[i ].getText()))) setSliderValue(i , scrollbars[i + 1].getValue()); } if (e != null && tfFolder == e.getSource()) { folder = tfFolder.getText(); folder = folder.replace("/" , File.separator); folder = folder.replace("\\", File.separator); if(!folder.endsWith(File.separator)) { folder += File.separator; tfFolder.setText(folder); } file = new File(folder); if(!file.exists()) { boFolder = false; tfFolder.setBackground(Color.RED); } else { boFolder = true; tfFolder.setBackground(Color.WHITE); list = file.list(); for (i = 0; i != list.length; i++) { file = new File(folder + list[i]); if(file.isFile() && list[i].endsWith(".tif") && list[i].indexOf("_Cell") > 0 && (list[i].indexOf("_Cell") + 13) <= list[i].length()) break; } if(i == list.length) { boFile1 = false; tfFile1.setBackground(Color.RED); tfFile1.setText("No valid sequence images file could be found"); } else { boFile1 = true; tfFile1.setBackground(Color.WHITE); tfFile1.setText(list[i].substring(0 , list[i].indexOf("_Cell") + 6)); } file = new File( folder.substring(0, folder.lastIndexOf(File.separator)) + link + "Reference" + File.separator); if (!file.exists()) { boFile2 = false; tfFile2.setBackground(Color.RED); tfFile2.setText("The folder \"" + folder.substring(0, folder.lastIndexOf(File.separator)) + link + "Reference\" cannot be found!"); } else { list = file.list(); for (i = 0; i != list.length; i++) { file = new File(folder.substring(0, folder.lastIndexOf(File.separator)) + link + "Reference" + File.separator + list[i]); if(file.isFile() && list[i].endsWith(".tif") && list[i].indexOf("_Cell") > 0 && (list[i].indexOf("_Cell") + 13) <= list[i].length()) break; } if(i == list.length) { boFile2 = false; tfFile2.setBackground(Color.RED); tfFile2.setText("No valid reference images could be found in the \"" + tfFolder.getText().substring(0, tfFolder.getText().length() - 1) + "_-_Reference\" folder"); } else { boFile2 = true; tfFile2.setBackground(Color.WHITE); tfFile2.setText(list[i].substring(0 , list[i].indexOf("_Cell") + 6)); } } } } if (e != null && tfFile1 == e.getSource()) { file1 = tfFile1.getText(); if (file1.endsWith("Cell_")) { boFile1 = true; tfFile1.setBackground(Color.WHITE); } else if (file1.endsWith(".tif") && file1.lastIndexOf(File.separator) != -1 && file1.indexOf("_Cell") > 0) tfFile1.setText(file1.substring(file1.lastIndexOf(File.separator) + 1, file1.indexOf("_Cell") + 6)); else if (!file1.endsWith("could be found")) tfFile1.setText("No valid sequence images file could be found"); else { boFile1 = false; tfFile1.setBackground(Color.RED); } } if (e != null && tfFile2 == e.getSource()) { file2 = tfFile2.getText(); if (file2.endsWith("Cell_")) { boFile2 = true; tfFile2.setBackground(Color.WHITE); } else if (file2.endsWith(".tif") && file2.lastIndexOf(File.separator) != -1 && file2.indexOf("_Cell") > 0 && file2.indexOf("Reference") > 0) tfFile2.setText(file2.substring(file2.lastIndexOf(File.separator) + 1, file2.indexOf("_Cell") + 6)); else if (!file2.endsWith("could be found")) tfFile2.setText("No valid reference images could be found in the \"" + tfFolder.getText().substring(0, tfFolder.getText().length() - 1) + "_-_Reference\" folder"); else { boFile2 = false; tfFile2.setBackground(Color.RED); } } // if (boFolder && boFile1 && boFile2) if (boFolder && boFile1 && (boFile2 || !checkboxes[10].getState())) return true; else return false; } public void mouseClicked(MouseEvent evt) { if (evt.getSource() instanceof ImagePanel) { for (int i = 0; i != imagePanels.length; i++) { if (evt.getSource() == imagePanels[0]) helpURL = "#hid_data_folder"; else if (evt.getSource() == imagePanels[1]) helpURL = "#hid_sequence_images"; else if (evt.getSource() == imagePanels[2]) helpURL = "#hid_reference_images"; else if (evt.getSource() == imagePanels[i]) helpURL = "#UM" + (i + 21); } helpMacro = "call('ij.plugin.BrowserLauncher.open', '" + linkRoot + "JEasyTFM_manual.html" + helpURL + "');"; new MacroRunner(helpMacro); } } public void mousePressed(MouseEvent evt) {} public void mouseExited(MouseEvent evt) {} public void mouseEntered(MouseEvent evt) {} public void mouseReleased(MouseEvent evt) {} public void mouseWheelMoved(MouseWheelEvent e) { for (int i = 0; i < scrollbars.length; i++) // mouseWheelEvents for numeric input fields { if (e != null && e.getSource() == scrollbars[i]) { val = scrollbars[i].getValue() + e.getWheelRotation(); if(val >= scrollbars[i].getMinimum() && val < scrollbars[i].getMaximum()) setSliderValue(i, val); return; } if (e != null && e.getSource() == scrollTFds[i]) { val = Integer.parseInt(scrollTFds[i].getText()) + e.getWheelRotation(); if(val >= scrollbars[i].getMinimum() && val < scrollbars[i].getMaximum()) setSliderValue(i, val); return; } } } public void focusGained(FocusEvent e) { } public void focusLost(FocusEvent e) { int i; for (i = 0; i <= 16; i++) { if(scrollTFds[i] == e.getSource()) { if(Integer.parseInt(scrollTFds[i].getText()) > scrollbars[i].getMaximum()) setSliderValue(i, scrollbars[i].getMaximum() - 1); if(Integer.parseInt(scrollTFds[i].getText()) < scrollbars[i].getMinimum()) setSliderValue(i, scrollbars[i].getMinimum()); } } } void setSliderValue(int index, int value) { scrollbars[index].setValue(value); scrollTFds[index].setText (String.valueOf(value)); } public void showAbout() { String aboutMessage = "\nThis package able the automatic analysis of TFM data in time lapse with:\n" + "\t- 1 to 2 beads channels (i.e. with two different beads colors)\n" + "\t- 1 to 3 cells channels (for example with Bright Field, GFP and Hoechst channels)\n" + "\t- multi-positions (i.e. several sample positions within a given experiment)\n" + "\t- calculation of the traction forces\n" + "\t- automatic cells segmentation carried out from their BF images\n" + "\t- integration of the forces over the cells\n" + "\t- tracking of the beads\n" + "\t- focal adhesion segmentations\n" + "\t- calculation of the traction forces applied on the focal adhesions\n" + "\t- batch-processing using jobs creation, launching and tracking\n\n" + "Released version:\t2.2\t\t18-06-2023\n" + "Required version:\tImageJ 1.54f11 or higher\n" + "Runing version:\tImageJ " + IJ.getFullVersion() + "\n\n" + "Author :\t\tPhilippe Carl\t(philippe.carl@unistra.fr)"; // gd = new GenericDialog ("JEasyTFM - About..."); gd = new NonBlockingGenericDialog ("JEasyTFM - About..."); gd.setIconImage (icon); try { url = getClass().getResource("/image/JEasyTFM_logo.jpg"); image = Toolkit.getDefaultToolkit().getImage(url); imp = new ImagePlus("Error message", image); gd .addImage(imp); } catch (Exception e) { IJ.showMessage("Loading the insert image", "The image \"/image/JEasyTFM_logo.jpg\" could not be found!"); } gd.addTextAreas(aboutMessage, null, 18, 69); gd.enableYesNoCancel ("Get user manual", "Get I/O formats manual"); gd.setCancelLabel ("Close"); gd.addHelp (linkRoot + "JEasyTFM.html"); gd.setHelpLabel ("Go to Website"); gd.showDialog (); if (gd.wasCanceled()) return; if (gd.wasOKed()) new MacroRunner("run('URL...', 'url=" + linkRoot + "download" + File.separator + "JEasyTFM_-_User_manual.pdf" + "');"); else new MacroRunner("run('URL...', 'url=" + linkRoot + "download" + File.separator + "JEasyTFM_-_Input_and_output_files_and_folders_names_and_format.pdf" + "');"); } }