Reading in a stacked (multiple-image) TIF file into separate waves

Hi all: I want to read in a multiple-image TIF file into separate 2D image waves, one for each layer in the stack. Accord to the help file for ImageLoad, if I do not use the LR3D flag that's what should happen:

You can also load the images into:
•    Separate 2D waves by omitting the /LR3D flag
•    A single 3D wave by using the /LR3D flag

However, when I run the following code snippet the loaded wave is a single 3D wave with 3 layers, instead of the three 2D waves I expected.

I am able to plot each layer of the 3D tif using the "Do not treat multi-layer images as direct color" option in New Image Plot, and they look as expected.

Any ideas on how to fix this (other than manually putting each layer into a wave, which isn't that bad, I guess)?

function test()

    Make/O/N=(100,100,3) stackWave

    stackwave[][][0] = sin(x)
    stackwave[][][1] = sin(y)
    stackwave[][][2] = sin(x)*cos(y)

    ImageSave/O/DS=32/T="tiff"/S stackwave

    ImageLoad/O/Q/C=-1

end

 

As far as I recall in designing the Image Tools package, when loading a stack as a separate set of image files, I had first to get the number of images in the stack and then load each layer selectively from the stack. Perhaps IP 9 has added a flag to make this option available directly.

Hi Jim: Igor 8.04. I have tried this script on both PC and Mac, and get the same result.

When you use /C=-1 you are telling Igor to load all layers and in this case, all images are loaded into a single wave.  A single wave is usually easier to manage.  If you need individual waves follow ImageLoad with SplitWave.

FWIW, historically /LR3D dates from the days that memory was at a premium so the default behavior did not favor large 3D waves.

A.G.

In reply to by Igor

Thanks, A. G. Perhaps the help file can be updated to reflect this behavior, since the documentation states,

You can also load the images into:
•    Separate 2D waves by omitting the /LR3D flag
•    A single 3D wave by using the /LR3D flag

Also, thanks for the pointer to the SplitWave function. I was trying to do this in a more complex way.

In the unlikely event that you do want to have ImageLoad produce the individual layer waves and, if your TIFF images can be read by the Igor's internal code you can execute:

ImageLoad/BIGT=0/C=0

C=-1 tells Igor to read all images and stores them into one wave.  Note that when you use the /S flag your choices for /C are either -1 or some positive integer.