How to view z axis of 3d image cube with cursor

Hello everyone,

I am analyzing a 3d image cube, with (rows, columns, layers) representing (X location, Y location, wavelength), respectively. In ENVI, you can open an image and use cursor to pick pixel at specific location (XX and YY), and then there is another window showing the spectral profile (plotting of Z axis values vs wavelength). This is really convenient. I was wondering if I can achieve it in Igor. Now I only know I can preview the layer of 3d wave in data browser. Thank you very much!

You could program it. You could make a panel with two subwindows separated by a frame guide down the middle. Subwindow one will show a 2D XY image at a specified wavelength and subwindow two your 1D spectrum. Use Ctrl+i to place a cursor on the image and make a button which updates the 1D spectrum, or if you want the fancy version a hook function that runs when the cursor is moved.

Have you done any programming in Igor already?

The Image Processing Demo experiment has a 3-views panel for visualizing 3D volumes.

File->Examples->Imaging->Image Processing Demo.

 

In reply to by JimProuty

Hello JimProuty,

Thank you for your suggestions. I have tried your method, but I found these three Line profiles are still in the horizontal direction, none of them are showing the z profile.

For example, I made a 3d wave, test, and define the values equal r. Then if one of the profile are showing z axis, it should not be a horizontal line.

Please let me know if I can change the direction of the red line. Thank you.

In reply to by olelytken

Hello olelytken,

Thank you very much! I will try your method today.

I have some experience on programming in Igor. I was trying to find if the Igor have build in function can achieve this, now I think maybe I should make it myself. Thanks.

 

Here is something that might help.

function DisplaySumImage(cube)
    wave cube
   
    // create image from cube, e.g. using sumBeams
    MatrixOP/O M_SumImage = sumBeams(cube)
   
    DoWindow/F CubeImage
    if (V_flag == 0)
        NewImage/K=1/N=CubeImage M_SumImage
        SetWindow CubeImage,hook(s)=HookFunc   
    endif
end

Function HookFunc(s)
    STRUCT WMWinHookStruct &s
   
    wave/Z cube
    wave/Z M_SumImage
    if(!WaveExists(cube) || !WaveExists(M_SumImage))
        return 0
    endif
   
    // where is the mouse?
    variable xx = round(AxisValFromPixel("", "Bottom", s.mouseLoc.h))
    variable yy = round(AxisValFromPixel("", "Left", s.mouseLoc.v))
    variable maxX = DimSize(cube, 0)
    variable maxY = DimSize(cube, 1)
   
    switch(s.eventCode)    
        case 3:     // handle left mouse click         
            // prevent error when clicking outside of image
            if (xx >= maxX || yy >= maxY || xx < 0  || yy < 0)
                break
            endif
           
            // extract spectrm 
            MatrixOp/O CrsSpec = beam(cube, xx, yy)
            DoWindow/F Spectrum
            if (V_flag==0)
                Display/K=1/N=Spectrum CrsSpec 
            endif
            break          
    endswitch
   
    return 1
End

 

If you execute "DisplaySumImage(cube)", where cube represents your spectral image wave, you'll get a "sum-image" as 2D representation, then clicking into it will show the spectrum at that location. Note that the spectrum is not yet scaled to energy.