Dear all (probably mostly Wayne)
I have some little changes to propose to imageJ with the hope this can be added to the next version of ImageJ. 1 - getDimensionsFromName function in ImportDialog.java I adapted the name of my images to use this function, but this limits at 3 numbers only in the filename. With this rewrite, you get the same functionnalities even if you have more than 3 numbers private void getDimensionsFromName(String name) { if (name==null) return; int lastUnderscore = name.lastIndexOf("_"); String name2 = name; if (lastUnderscore>=0) name2 = name.substring(lastUnderscore); char[] chars = new char[name2.length()]; for (int i=0; i<name2.length(); i++) // change non-digits to spaces chars[i] = Character.isDigit(name2.charAt(i))?name2.charAt(i):' '; name2 = new String(chars); String[] numbers = Tools.split(name2); int n = numbers.length; if (n<2) return; int w = (int)Tools.parseDouble(numbers[0],0); if (w<10) return; int h = (int)Tools.parseDouble(numbers[1],0); if (h<10) return; width = w; height = h; nImages = 1; if (n>2) { int d = (int)Tools.parseDouble(numbers[2],0); if (d>0) nImages = d; } guessFormat(directory, name); } 2 - getLabel in Plot.java I change this function to be public so I can access to label axis and units from Plot window directly in my plugin. public String getLabel(char c) 3 - addToLists in Plot.java this changes let me show/import data with axis label and eventually units with "List" button or "Copy All Ddata". (I changed only the first two headers) void addToLists(ArrayList<String> headings, ArrayList<float[]>data, PlotObject plotObject, int dataSetNumber, boolean writeX, boolean writeY, boolean multipleSets) { if (writeX) { String label = plotObject.type == PlotObject.ARROWS ? "XStart" : "X"; if (multipleSets) label += dataSetNumber; if (dataSetNumber == 0) { String plotXLabel = getLabel('x'); if (plotXLabel != null) label = plotXLabel; } headings.add(label); data.add(plotObject.xValues); } if (writeY) { String label = plotObject.type == PlotObject.ARROWS ? "YStart" : "Y"; if (multipleSets) label += dataSetNumber; if (dataSetNumber == 0) { String plotYLabel = getLabel('y'); if (plotYLabel != null) label = plotYLabel; } headings.add(label); data.add(plotObject.yValues); } if (plotObject.xEValues != null) { String label = plotObject.type == PlotObject.ARROWS ? "XEnd" : "XERR"; if (multipleSets) label += dataSetNumber; headings.add(label); data.add(plotObject.xEValues); } if (plotObject.yEValues != null) { String label = plotObject.type == PlotObject.ARROWS ? "YEnd" : "ERR"; if (multipleSets) label += dataSetNumber; headings.add(label); data.add(plotObject.yEValues); } } Best, François -- François GANNIER STIM - CNRS ERL7368 Signalisation et Transports Ioniques Membranaires (STIM) Groupe Physiol. Cell. Card. & Vasc. (PCCV), UFR Sciences&Techniques, Parc Grandmont, 37200 Tours - FRANCE tel: 33 (0)2 47367113 fax: 33 (0)2 47367013 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
> On Dec 13, 2017, at 10:36 AM, François GANNIER (PCCV) <[hidden email]> wrote:
> > Dear all (probably mostly Wayne) > > I have some little changes to propose to imageJ with the hope this can be added to the next version of ImageJ. > > 1 - getDimensionsFromName function in ImportDialog.java > I adapted the name of my images to use this function, but this limits at 3 numbers only in the filename. > With this rewrite, you get the same functionnalities even if you have more than 3 numbers This change is in the latest ImageJ daily build (1.51t14). > private void getDimensionsFromName(String name) { > if (name==null) return; > int lastUnderscore = name.lastIndexOf("_"); > String name2 = name; > if (lastUnderscore>=0) > name2 = name.substring(lastUnderscore); > char[] chars = new char[name2.length()]; > for (int i=0; i<name2.length(); i++) // change non-digits to spaces > chars[i] = Character.isDigit(name2.charAt(i))?name2.charAt(i):' '; > name2 = new String(chars); > String[] numbers = Tools.split(name2); > int n = numbers.length; > if (n<2) return; > int w = (int)Tools.parseDouble(numbers[0],0); > if (w<10) return; > int h = (int)Tools.parseDouble(numbers[1],0); > if (h<10) return; > width = w; > height = h; > nImages = 1; > if (n>2) { > int d = (int)Tools.parseDouble(numbers[2],0); > if (d>0) > nImages = d; > } > guessFormat(directory, name); > } > > 2 - getLabel in Plot.java > I change this function to be public so I can access to label axis and units from Plot window directly in my plugin. > > public String getLabel(char c) This method is public in the latest daily build. > 3 - addToLists in Plot.java > this changes let me show/import data with axis label and eventually units with "List" button or "Copy All Ddata". > (I changed only the first two headers) In the daily build, the x and y-axis labels are used as the first two column headings in the table created by the plot window "List” command, but only when these labels start and end with a space character. -wayne > void addToLists(ArrayList<String> headings, ArrayList<float[]>data, PlotObject plotObject, > int dataSetNumber, boolean writeX, boolean writeY, boolean multipleSets) { > if (writeX) { > String label = plotObject.type == PlotObject.ARROWS ? "XStart" : "X"; > if (multipleSets) label += dataSetNumber; > if (dataSetNumber == 0) { > String plotXLabel = getLabel('x'); > if (plotXLabel != null) > label = plotXLabel; > } > headings.add(label); > data.add(plotObject.xValues); > } > if (writeY) { > String label = plotObject.type == PlotObject.ARROWS ? "YStart" : "Y"; > if (multipleSets) label += dataSetNumber; > if (dataSetNumber == 0) { > String plotYLabel = getLabel('y'); > if (plotYLabel != null) > label = plotYLabel; > } > headings.add(label); > data.add(plotObject.yValues); > } > if (plotObject.xEValues != null) { > String label = plotObject.type == PlotObject.ARROWS ? "XEnd" : "XERR"; > if (multipleSets) label += dataSetNumber; > headings.add(label); > data.add(plotObject.xEValues); > } > if (plotObject.yEValues != null) { > String label = plotObject.type == PlotObject.ARROWS ? "YEnd" : "ERR"; > if (multipleSets) label += dataSetNumber; > headings.add(label); > data.add(plotObject.yEValues); > } > } -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |