Re: Mac vs Windows VirtualStack behaviour
Posted by
Wayne Rasband-2 on
Jun 26, 2019; 10:38pm
URL: http://imagej.273.s1.nabble.com/Mac-vs-Windows-VirtualStack-behaviour-tp5022264p5022286.html
> On Jun 25, 2019, at 5:56 PM, otills <
[hidden email]> wrote:
>
> I am using a Python script to load a list of .tif files from a .txt list and
> to display these as a Virtual Stack.
The following JavaScript example opens a folder of images as a virtual stack. To get the width and height, it opens the last image in the folder. It does this because on macOS the first file may be ".DS_Store". An easier, but less flexible, way to open a folder of images is to use:
img = FolderOpener.open(dir,"virtual”).
-wayne
dir = “C:/Users/rasba/stack/";
f = new File(dir);
list = f.list();
n = list.length;
img = IJ.openImage(dir+list[n-1]);
stack = new VirtualStack(img.getWidth(),img.getHeight(),null,dir);
for (i=0; i<n; i++)
stack.addSlice(list[i]);
img2 = new ImagePlus(""+dir,stack);
img2.show();
> for f in filtFiles:
> if vs is None:
> imp = IJ.openImage(f)
> vs = VirtualStack(imp.width, imp.height, None,"/")
> vs.addSlice(f)
> imPlus = ImagePlus("Stack from subdirectories", vs)
> print imPlus
> imPlus.show()
>
> I know that the file list import part of the code is working fine as the
> following successfully opens and displays an image:
> imp = IJ.openImage(filtFiles[0])
> imp.show()
>
> The really strange thing here is that on Macs this same script works
> absolutely without issue. However, on PCs I get a blank stack loaded with
> the text 'File not found: ....' on each frame. The file path appears fine as
> IJ.openImage with precisely the same file path works.
>
> What am I missing?
>
> Thanks!
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html