Skip to content
Browse files

Show checkbox dialog to select channels

  • Loading branch information...
1 parent 39b7525 commit f86d9a9ab5b5e8395c335460dcc41ba280ead8db @thomie committed Apr 17, 2011
Showing with 28 additions and 9 deletions.
  1. +23 −4 Ics_Opener_To_Tiff.java
  2. +2 −2 README
  3. +3 −3 plugins.config
View
27 Ics_Opener_To_Tiff.java
@@ -31,10 +31,8 @@ public void run(String arg) {
showAbout();
} else if (arg.equals("open")) {
this.openMultiple();
- IJ.showMessage("If you didn't see any errors: converted channel 3 of all Ics images to TIFF files");
} else {
this.openMultiple();
- IJ.showMessage("If you didn't see any errors: converted channel 3 of all Ics images to TIFF files");
}
return;
}
@@ -45,7 +43,7 @@ private void showAbout() {
" Thomas Miedema (thomasmiedema@gmail.com), March 2011"
);
}
-
+
public void open(String path) {
if (!IJ.isJava2()) { //wsr
@@ -416,7 +414,25 @@ public void OpenIcs () {
impNew.getProcessor().resetMinAndMax();
impNew.show();
} else { // less than MAX_CHANNELS channels
- for (int ch=2; ch < nChannels; ch++) {
+ GenericDialog gd = new GenericDialog("Select channels");
+ String[] labels = new String[nChannels];
+ boolean[] defaults = new boolean[nChannels];
+ for (Integer ch=0; ch < nChannels; ch++) {
+ Integer chCount = new Integer(ch+1);
+ labels[ch] = "Channel: " + chCount.toString();
+ defaults[ch] = false;
+ }
+ gd.addCheckboxGroup(nChannels, 1, labels, defaults);
+ gd.showDialog();
+ if (gd.wasCanceled()) return;
+
+ Integer nChannelsSelected = 0;
+ for (int ch=0; ch < nChannels; ch++) {
+ if (!gd.getNextBoolean()) {
+ // Check if user selected this channel.
+ continue;
+ }
+ nChannelsSelected++;
Integer chCount=new Integer(ch+1);
FileOpener fo=new FileOpener(fi[ch]);
ImageStack stackNew = new ImageStack(width, height,fo.createColorModel(fi[ch]));
@@ -437,6 +453,9 @@ public void OpenIcs () {
impNew.getProcessor().resetMinAndMax();
//impNew.show();
}
+ if (nChannelsSelected > 0) {
+ IJ.showMessage("Converted " + nChannelsSelected.toString() + " channels of all selected Ics images to TIFF files");
+ }
}
}
IJ.showStatus ("Done opening ICS file...");
View
4 README
@@ -1,6 +1,6 @@
See: http://valelab.ucsf.edu/~nico/IJplugins/Ics_Opener.html
-With this version you can select multiple files at once. It will save channel 3 to tiff files, and ignore all other channels.
+With this version you can select multiple files at once. It will then show a dialog where you can select the channels you want to convert to tiff files.
* Install ImageJ: http://rsbweb.nih.gov/ij/
@@ -14,7 +14,7 @@ Ubuntu: $HOME/.imagej/plugins
Edit -> Options -> Input/Output -> 'Use JFileChooser to open/save'
* To convert the Ics files to Tiff:
-Plugins -> InputOutput -> Ics/Ids channel 3 to Tiff
+Plugins -> InputOutput -> Ics/Ids to Tiff
Use the Contol key the select multiple files at once, or type this in the File Name box: *.ics or *.tif.
View
6 plugins.config
@@ -6,6 +6,6 @@
# Requires: ImageJ 1.31s
# Generate the jar file using: "jar cvfM Ics_Opener_To_Tiff.jar *"
-File>Import, "ICS/IDS channel 3 to TIFF..", Ics_Opener_To_Tiff("open")
-Plugins>InputOutput, "ICS/IDS channel 3 to TIFF.. ", Ics_Opener_To_Tiff("open")
-Help>About Plugins, "ICS/IDS channel 3 to TIFF.. ", Ics_Opener_To_Tiff("about")
+File>Import, "ICS/IDS to TIFF..", Ics_Opener_To_Tiff("open")
+Plugins>InputOutput, "ICS/IDS to TIFF.. ", Ics_Opener_To_Tiff("open")
+Help>About Plugins, "ICS/IDS to TIFF.. ", Ics_Opener_To_Tiff("about")

0 comments on commit f86d9a9

Please sign in to comment.
Something went wrong with that request. Please try again.