threshold 3Dwave


I am Giorgia and I am really new in Igor. I would like to analyze a movie (let's say 500 frames). The movie shows particles (which are my ROI) travelling along a channel. I want to create a projection of these particles (so at the end I should obtain one single image), and I would need to threshold and average the signal of the particles (so, I guess of the single frame).
In this case I would need to threshold a 3D wave. But, does the Imagethreshold return a 2D wave?if so, this part of the code is not correct "ImageTransform/R=M_Imagethresh averageImage input3dwaveNup", isn't it?

This the code that I am using:

function Part (input3DwaveNup,input3DwaveCargo,threshold)
wave input3DwaveNup, input3DwaveCargo
variable threshold
wave M_Imagethresh, M_AveImage
variable i,j,k, waveMaxNup, WaveMaxCargo, WaveMinNup, WaveMinCargo, ImageNum = dimsize(input3dwaveNup,2)
variable t1=startmstimer, timerRefNum

make/d/o/n=(dimsize(input3dwaveNup,0),dimsize(input3dwaveNup,1), dimsize(input3dwaveNup,2)) dummy3D
make/d/o/n=(dimsize(input3dwaveNup,0),dimsize(input3dwaveNup,1)) outputwaveNup = 0, outputwaveCargo = 0, RatioCargoVsNup=0

Imagethreshold/T=(threshold) input3dwaveNup
ImageTransform/R=M_Imagethresh averageImage input3dwaveNup
outputwaveNup = M_aveimage
ImageTransform/R=M_Imagethresh averageImage input3dwavecargo
outputwavecargo = M_aveimage

newimage outputwaveNup
newimage outputwaveCargo



Hello Giorgia,

I am not sure I understand what you mean by "projection of these particles". One possibility is that you want the result of:
ImageTransform/METH=3 zProjection input3dwave

Since you appear to have a threshold parameter you could replace the threshold and the average with:
MatrixOP/O/FREE aa=255*greater(threshold,input3dwave)  // switch order of params of greater() depending on your threshold definition.
ImageTransform/METH=3 zProjection aa

Note that your code contains two Make commands that are not necessary. For example, the combination of:
make/d/o/n=(dimsize(input3dwaveNup,0),dimsize(input3dwaveNup,1)) outputwaveNup = 0
ImageTransform/R=M_Imagethresh averageImage input3dwaveNup
outputwaveNup = M_aveimage

can be replaced by:
ImageTransform/R=M_Imagethresh averageImage input3dwaveNup
Wave M_AveImage  // note the correct name
Duplicate/O M_AveImage,outputwaveNup


WaveMetrics, Inc.
Imagethreshold can return a 3D wave if the input is 3D, it just operates on each layer separately. The trouble is that the /R tag of ImageTransform can't accept a 3D wave for the ROI; it can't change the ROI layer-by-layer (frame-by-frame).

You could write your own code to replace the ImageTransform functions, perhaps using MatrixOp functions:
MatrixOp temporary3dMatrix=input3dwaveNup*greater(M_ImageThresh,1) //sets anything outside your 3D "ROI" to zero
MatrixOp averageImage=sumBeams(temporary3dMatrix)/(numPoints(beam(temporary3dMatrix,1,1))) //averages along the 3rd dimension of "beams" or layers
Many Thanks for the help.
I still have some issues with the code, but it's going better.

I would have one more question about how to load my BigTIFF. They are usually bigger than 5 GB. Is it possible to load such a big file in Igor7?
Or maybe, is there a way to open the first 500 frames of the movie, so run the analysis, then open the others 500 frame of the movie, run the analysis.... at the end sum the n results? I should have one single image as the final results.

Thank you!

This should really be in a different thread.

You can read a bigTiff image. Check the documentation for ImageLoad with the /BIGT=1 flag.

oh, you're right, i should have done a new thread!

For the bigTIf file, I tried and checked the /BIGT flag, but doesn't work. Upload only the first 2 frames.
Anyway I will do a new post with a correct thread.

Thanks thanks!!!