public class BatchDialog
extends fiji.util.gui.GenericDialogPlus
getDefaultInputs()
and then calling the getImageDirectory()
...
The class is compatible with headless execution of script/macro calling the plugin via the command
ImageJ-win64.exe --ij2 --console --run pathToScript with or without the --headless tag.
It is not compatible with
ImageJ-win64.exe --console -macro myMacro.ijm
at least without the --headless tag, an error related to the GUI is triggered.
Descendant classes should take care not to call GUI-related function in headless mode such as displaying images. The protected attribute headless can be used to test if(headless).
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
protected acquifer.core.im.FilenameFilter |
filenameFilter |
protected boolean |
headless
True only when called in console with tag --headless.
|
protected String |
imageDirectory |
java.awt.Label |
labelChannels |
java.awt.Label |
labelSubposition |
java.awt.Label |
labelTimepoint |
java.awt.Label |
labelZ |
protected Set<Integer> |
listChannels |
protected Set<Integer> |
listSubPositions |
protected Set<Integer> |
listTimepoints |
protected Set<acquifer.core.Well> |
listWells |
protected Set<Integer> |
listZslices |
protected int |
nColumns
Number of plate columns.
|
protected int |
nGroupCheckboxes |
protected int |
nRows
Number of plate rows.
|
protected acquifer.core.Plate |
plate |
protected List<java.awt.Checkbox> |
rowSelectionCheckboxes |
checkbox, choice, defaultChoiceIndexes, defaultStrings, defaultText, defaultValues, numberField, radioButtonGroups, slider, stringField, textArea1, textArea2, theLabel
Constructor and Description |
---|
BatchDialog(String title,
acquifer.core.im.FilenameFilter filenameFilter)
Default constructor defining the fixed left panel of the GUI.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Handle buttons clicks in the GUI.
|
void |
addDefaultDirectoryInput()
Add directory input to the GUI for the "default" directory.
|
void |
addMessageBold(String message)
Add a message with default font in bold to the GUI.
|
static Set<Integer> |
convertToIntegerSet(String stringInput)
Parse the selected dimensions (string input) to a list of integer.
|
void |
createAndSetDefaultDirectory(String directoryPath,
String defaultSubDirectory)
Set the "default" directory to the provided directory path.
|
boolean |
escapePressed()
If escape was pressed, display a message in ImageJ status bar, reset the progress bar and returns true.
|
java.awt.Font |
getBoldFont()
Return the default Font but bold, or null if it is in headless or if the plugin's GUI is not shown.
|
Set<Integer> |
getChannels()
Return selected channels, this function should be called after calling
getDefaultInputs() . |
List<java.awt.Checkbox> |
getCheckboxesForColumn(int column)
Return the list of checkboxes for wells of a given plate column.
|
List<java.awt.Checkbox> |
getCheckboxGroup()
Return a list containing all the checkboxes composing the checkbox group.
|
String |
getCurrentImageDirectory()
Return path currently in the GUI, if it corresponds to a valid directory, otherwise return null.
|
void |
getDefaultInputs()
Read all the default user-inputs (using the getNext*** methods, to be macro-recordable).
|
java.awt.Font |
getFont()
Return the default Font of the GUI when displayed, or null when the plugin call is through the command line.
|
List<java.awt.Checkbox> |
getHeaderCheckboxes()
Return a reference to the header checkboxes.
|
String |
getImageDirectory()
Return image directory, this function should be called after calling
getDefaultInputs() . |
acquifer.core.Dataset |
getMatchingDataset()
Return a Dataset representing the data matching the selected dimensions.
|
acquifer.core.Dataset |
getMatchingDataset(boolean showErrorWindow)
Return a Dataset representing the data matching the selected dimensions.
|
acquifer.core.Dataset |
getMatchingDataset(Comparator<acquifer.core.im.ImagePlane> sortOrder,
boolean showErrorWindow)
Return a Dataset representing the data matching the selected dimensions.
|
Set<Integer> |
getNextStringAsIntegers()
Parse a string of comma-separated integers from the next string input field of the dialog in a macro-recordable way.
|
boolean[] |
getSavedWellCheckboxState(acquifer.core.Plate plate)
Recover from persistence the state of the checkboxes for the full checkbox group as an array of boolean.
|
Set<Integer> |
getSubpositions()
Return selected subpositions, this function should be called after calling
getDefaultInputs() . |
Set<Integer> |
getTimepoints()
Return selected timepoints, this function should be called after calling
getDefaultInputs() . |
List<java.awt.Checkbox> |
getWellCheckboxes()
Return a list containing the checkboxes for the wells selection.
|
Set<acquifer.core.Well> |
getWells()
Return the set of wells selected, this function should be called after calling
getDefaultInputs() . |
Set<Integer> |
getZslice()
Return selected Z-slice, this function should be called after calling
getDefaultInputs() . |
void |
itemStateChanged(java.awt.event.ItemEvent event)
Define what happens when checkboxes or dropdown menus are changed.
|
static String |
readMacroContent(String macroFilePath)
Check that the input path corresponds to a macro file (.ijm or .txt) and return the content as a String.
|
void |
saveDefaultParameters()
This function save the default GUI parameters, expected in this order
- Input directory
- Channel selector
- Z-slice selector
- Timepoint selector
- well subposition
- well selections
It also saves the last visited/default directory for the OpenDialog. |
void |
saveWellCheckboxState()
Save the checkboxes states in persistence for the full checkbox group as a string "True, True, False..."
|
void |
setOKLabel(String label)
This method does not do anything on purpose.
The OK label should not be renamed, otherwise the parameters persistence wont work. See actionPerformed(ActionEvent) |
void |
showDialog()
Reorganise the GUI layout with left/right panels.
|
void |
textValueChanged(java.awt.event.TextEvent event)
This method react to change in text fields.
|
boolean |
validateInputs()
Check values entered in the dialog, to make sure they make sense (no negative...).
|
addButton, addComponent, addComponent, addDirectoryField, addDirectoryField, addDirectoryOrFileField, addDirectoryOrFileField, addFileField, addFileField, addImage, addImage, addImage, addImageChoice, addStringField, createImageIcon, getConstraints, getNextImage, keyPressed, keyReleased, keyTyped
addCheckbox, addCheckboxGroup, addCheckboxGroup, addChoice, addDialogListener, addEnumChoice, addHelp, addImage, addMessage, addMessage, addMessage, addNumericField, addNumericField, addNumericField, addPanel, addPanel, addPreviewCheckbox, addPreviewCheckbox, addRadioButtonGroup, addSlider, addSlider, addStringField, addTextAreas, addToSameRow, adjustmentValueChanged, centerDialog, dispose, enableYesNoCancel, enableYesNoCancel, focusGained, focusLost, getButtons, getCheckboxes, getChoices, getErrorMessage, getInsets, getInstance, getLabel, getMessage, getNextBoolean, getNextChoice, getNextChoiceIndex, getNextEnumChoice, getNextNumber, getNextRadioButton, getNextString, getNextText, getNumericFields, getPreviewCheckbox, getRadioButtonGroups, getSliders, getStringFields, getTextArea1, getTextArea2, getValue, hideCancelButton, invalidNumber, isMacro, isPreviewActive, paint, parseDouble, previewRunning, repaint, setCancelLabel, setDefaultString, setEchoChar, setFont, setHelpLabel, setInsets, setLocation, setSmartRecording, setup, wasCanceled, wasOKed, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, update, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected boolean headless
protected String imageDirectory
protected Set<Integer> listChannels
protected Set<Integer> listZslices
protected Set<Integer> listTimepoints
protected Set<Integer> listSubPositions
protected Set<acquifer.core.Well> listWells
protected acquifer.core.Plate plate
protected int nRows
protected int nColumns
protected int nGroupCheckboxes
protected List<java.awt.Checkbox> rowSelectionCheckboxes
protected final acquifer.core.im.FilenameFilter filenameFilter
public java.awt.Label labelSubposition
public java.awt.Label labelChannels
public java.awt.Label labelZ
public java.awt.Label labelTimepoint
public BatchDialog(String title, acquifer.core.im.FilenameFilter filenameFilter)
public java.awt.Font getFont()
getFont
in interface java.awt.MenuContainer
getFont
in class java.awt.Component
public java.awt.Font getBoldFont()
addMessageBold(String)
which prevent issues.public void addMessageBold(String message)
public boolean escapePressed()
public void showDialog()
showDialog
in class ij.gui.GenericDialog
public void addDefaultDirectoryInput()
public void createAndSetDefaultDirectory(String directoryPath, String defaultSubDirectory)
directoryPath
- full path to custom directory to create, or "" to use the default subdirectorydefaultSubDirectory
- if directoryPath="", default subdirectory to create within the IM experiment directory.public static String readMacroContent(String macroFilePath) throws IllegalArgumentException, IOException
macroFilePath
- must be a .ijm or .txt file.IllegalArgumentException
- if the file is not a .txt or .ijm or is not existing.IOException
- if the file cannot be read.public List<java.awt.Checkbox> getWellCheckboxes()
public List<java.awt.Checkbox> getCheckboxGroup()
public List<java.awt.Checkbox> getHeaderCheckboxes()
public List<java.awt.Checkbox> getCheckboxesForColumn(int column)
public void saveWellCheckboxState()
public void saveDefaultParameters()
public boolean[] getSavedWellCheckboxState(acquifer.core.Plate plate)
public void setOKLabel(String label)
actionPerformed(ActionEvent)
setOKLabel
in class ij.gui.GenericDialog
public void textValueChanged(java.awt.event.TextEvent event)
textValueChanged
in interface java.awt.event.TextListener
textValueChanged
in class ij.gui.GenericDialog
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class ij.gui.GenericDialog
public void itemStateChanged(java.awt.event.ItemEvent event)
itemStateChanged
in interface java.awt.event.ItemListener
itemStateChanged
in class ij.gui.GenericDialog
public static Set<Integer> convertToIntegerSet(String stringInput)
public void getDefaultInputs()
getImageDirectory()
...public boolean validateInputs()
public Set<Integer> getNextStringAsIntegers()
public String getCurrentImageDirectory()
public String getImageDirectory()
getDefaultInputs()
. getCurrentImageDirectory()
public Set<Integer> getChannels()
getDefaultInputs()
.public Set<Integer> getZslice()
getDefaultInputs()
.public Set<Integer> getTimepoints()
getDefaultInputs()
.public Set<Integer> getSubpositions()
getDefaultInputs()
.public Set<acquifer.core.Well> getWells()
getDefaultInputs()
.
The returned set is a copy of the instance attribute to prevent modifications.public acquifer.core.Dataset getMatchingDataset(Comparator<acquifer.core.im.ImagePlane> sortOrder, boolean showErrorWindow) throws InstantiationException
sortOrder
- optional order to sort the list of images in the dataset, can be null.showErrorWindow
- if true, an ImageJ error window is shown if an error occurs, in addition to the stack trace.IllegalArgumentException
- when no images match the dimensions filters.InstantiationException
public acquifer.core.Dataset getMatchingDataset(boolean showErrorWindow) throws InstantiationException
showErrorWindow
- if true, an ImageJ error window is shown if an error occurs, in addition to the stack trace.IllegalArgumentException
- when no images match the dimensions filters.InstantiationException
public acquifer.core.Dataset getMatchingDataset() throws InstantiationException
IllegalArgumentException
- when no images match the dimensions filters.InstantiationException