Re: Pointing to a fixed directory structure
Posted by
David Webster on
Oct 13, 2009; 7:29pm
URL: http://imagej.273.s1.nabble.com/Pointing-to-a-fixed-directory-structure-tp3690781p3690786.html
You may need to use "\\" rather than "\" as a single slash is an escape
character in both Java and C.
On Tue, Oct 13, 2009 at 11:52 AM, Dean Raby <
[hidden email]> wrote:
> I am new to writing Java (2 months), but find the ImageJ a very interesting
> tool, and hope to write a few plugins to "quickly" test some imaging
> concepts. This work requires me to compare three images. The available
> examples, i have found, show the image information being taken from the
> image selected via the GUI however i need my plugin to read the contents
> from a fixed directory on the host PC. The image names will also be hard
> coded by the camera attached to the PC. If you have a pointer to a similar
> plugin or example it would be greatly appreciated.
>
> I have tried to read 3 bitmap images from the same directory and have been
> unable to set the correct path. Could you let me know from which location
> the path should be set relative to (i am running Eclipse on my PC):
>
> plugin directory path: C:\Code\Java\MyPlugin\src\test_.java
> image directory path: C:\Code\Java\MyPlugin\images\xxx.bmp
>
> I have tried using the full system path and the relative path and neither
> one seems to work.
>
> I am trying to use, to point to and open a test image:
>
> String imagePath =
> IJ.getDirectory("C:\Code\Java\MyPlugin\images\test1.bmp");
> dirPath = IJ.openAsString(imagePath);
> ImagePlus imp2 = IJ.openImage(dirPath);
>
> In the above code, the "slash" direction reflects that shown on the Eclipse
> tool, please let me know if is need to parse this and change the "slash"
> direction.
>
> thank you, Dean
>