Hello everybody,
I have tried to google the problem, but did not fine an answer. I am using the FileInfo class i ImageJ to get the directory and the file name of the graphic file my plugin is working on. If I drag files (single files, or a group of selected files in a directonary everything works ok (output from sample plugin): Directory: C:\Program Files\ImageJ\plugins\Geralds\test\ test.tif If I instead choose to drag an entire catalog (subcatalog test) with all the pictures inside the same sample plugin shows this output: Directory: C:\Program Files\ImageJ\plugins\Geralds\test/\ test.tif It is not dificoult to remove this '/' but I am afraid this may couse problems on other OS than Windows (I use XP). Any idea why FileInfo behaves like that? Kind regards Gerald Sample plugin: import java.awt.*; import java.io.*; import ij.plugin.frame.*; import ij.*; import ij.process.*; import ij.gui.*; import ij.ImagePlus; import ij.io .*; public class FileInfoTest extends PlugInFrame { ImagePlus imp; ImageProcessor imPro; Frame instance; String resultFileName = "Testfile.txt"; public FileInfoTest() { super("FileInfoTest"); if (instance!=null) { instance.toFront(); return; } instance = this; imp = WindowManager.getCurrentImage(); if (imp==null) { IJ.beep(); IJ.noImage(); return; } imPro = imp.getProcessor(); FileInfo fi = imp.getOriginalFileInfo(); IJ.log("Directory: " + fi.directory); IJ.log("File name: " + fi.fileName); } } |
Hi,
I think I don't understand what you mean with catalog and subcatalog tests and dragging. Your plugin uses the currently active image, so I can't drag anything. I ran your attached code and I got these results: Directory: /home/juanjo/Desktop/SampleData/Imgs/ File name: img000012.xmp I'm using imageJ on Ubuntu Linux, and for me it seems to be fine. I don't know it this is enough to fix your problem, but I don't think so. Maybe if you try to explain it better I could help you. Sincerelly, Juanjo Vega. On Thu, 2010-06-10 at 12:21 -0700, GeraldT wrote: > Hello everybody, > > I have tried to google the problem, but did not fine an answer. I am using > the FileInfo class i ImageJ > to get the directory and the file name of the graphic file my plugin is > working on. If I drag files (single files, > or a group of selected files in a directonary everything works ok (output > from sample plugin): > Directory: C:\Program Files\ImageJ\plugins\Geralds\test\ > test.tif > > If I instead choose to drag an entire catalog (subcatalog test) with all the > pictures inside the same sample plugin shows this output: > Directory: C:\Program Files\ImageJ\plugins\Geralds\test/\ > test.tif > > It is not dificoult to remove this '/' but I am afraid this may couse > problems on other OS than Windows (I use XP). > > Any idea why FileInfo behaves like that? > > Kind regards > Gerald > > Sample plugin: > > import java.awt.*; > import java.io.*; > import ij.plugin.frame.*; > import ij.*; > import ij.process.*; > import ij.gui.*; > import ij.ImagePlus; > import ij.io .*; > > public class FileInfoTest extends PlugInFrame { > > ImagePlus imp; > ImageProcessor imPro; > Frame instance; > > String resultFileName = "Testfile.txt"; > > public FileInfoTest() { > super("FileInfoTest"); > if (instance!=null) { > instance.toFront(); > return; > } > > instance = this; > imp = WindowManager.getCurrentImage(); > if (imp==null) { > IJ.beep(); > IJ.noImage(); > return; > } > > imPro = imp.getProcessor(); > > FileInfo fi = imp.getOriginalFileInfo(); > IJ.log("Directory: " + fi.directory); > IJ.log("File name: " + fi.fileName); > > > } > > } > |
Hi Juanjo,
thank you for the reply. I think the problem might be Windows specific. What I ment: Example file structure: \.directory structure...\Testdir\file1.tif \.directory structure...\Testdir\file2.tif If I stand in the directory "Testdir" and mark the two files and drag them onto the ImageJ-window everything works correct. If i stand in the directory above and drag the entire "Testdir" directory onto ImageJ the same files open, but I get the extra "/" sign in the directory info. The idea is to work on and close the files one by one and the fileinfo is always on the active picture-window. Regards Gerald |
Hi,
On Fri, 2010-06-11 at 03:48 -0700, GeraldT wrote: > Hi Juanjo, > > thank you for the reply. I think the problem might be Windows specific. > What I ment: > Example file structure: > \.directory structure...\Testdir\file1.tif > \.directory structure...\Testdir\file2.tif > > If I stand in the directory "Testdir" and mark the two files and drag them > onto the ImageJ-window everything works correct. > If i stand in the directory above and drag the entire "Testdir" directory > onto ImageJ the same files open, > but I get the extra "/" sign in the directory info. > The idea is to work on and close the files one by one and the fileinfo is > always on the active picture-window. Doing that on Linux I get the same results: Directory: /home/juanjo/Desktop/images/12205/ File name: 12205_000017.xmp Directory: /home/juanjo/Desktop/images/12205/ File name: 12205_000008.xmp Directory: /home/juanjo/Desktop/images/12205/ File name: 12205_000026.xmp Directory: /home/juanjo/Desktop/images/12205/ File name: 12205_000008.xmp Directory: /home/juanjo/Desktop/images/12205/ File name: 12205_000007.xmp Directory: /home/juanjo/Desktop/images/12205/ File name: 12205_000006.xmp So, it might be what you say, a windows specific problem. I don't know how to fix it... Sincerelly, Juanjo Vega. > > Regards Gerald > > ----- > Kind regards > > Gerald R. Torgersen > Physicist > > Faculty of Dentistry, University of Oslo |
In reply to this post by GeraldT
On Jun 10, 2010, at 3:21 PM, GeraldT wrote:
> Hello everybody, > > I have tried to google the problem, but did not fine an answer. I am using > the FileInfo class i ImageJ > to get the directory and the file name of the graphic file my plugin is > working on. If I drag files (single files, > or a group of selected files in a directonary everything works ok (output > from sample plugin): > Directory: C:\Program Files\ImageJ\plugins\Geralds\test\ > test.tif > > If I instead choose to drag an entire catalog (subcatalog test) with all the > pictures inside the same sample plugin shows this output: > Directory: C:\Program Files\ImageJ\plugins\Geralds\test/\ > test.tif > > It is not dificoult to remove this '/' but I am afraid this may couse > problems on other OS than Windows (I use XP). > > Any idea why FileInfo behaves like that? This bug is fixed in the 1.44c11 daily build. -wayne > Sample plugin: > > import java.awt.*; > import java.io.*; > import ij.plugin.frame.*; > import ij.*; > import ij.process.*; > import ij.gui.*; > import ij.ImagePlus; > import ij.io .*; > > public class FileInfoTest extends PlugInFrame { > > ImagePlus imp; > ImageProcessor imPro; > Frame instance; > > String resultFileName = "Testfile.txt"; > > public FileInfoTest() { > super("FileInfoTest"); > if (instance!=null) { > instance.toFront(); > return; > } > > instance = this; > imp = WindowManager.getCurrentImage(); > if (imp==null) { > IJ.beep(); > IJ.noImage(); > return; > } > > imPro = imp.getProcessor(); > > FileInfo fi = imp.getOriginalFileInfo(); > IJ.log("Directory: " + fi.directory); > IJ.log("File name: " + fi.fileName); > > > } > > } > > -- > View this message in context: http://imagej.588099.n2.nabble.com/Extra-addet-in-FileInfo-directory-when-using-drag-and-drop-tp5164874p5164874.html > Sent from the ImageJ mailing list archive at Nabble.com. |
Free forum by Nabble | Edit this page |