Parameter out of range in ImageAnalyzeParticles

Hi,

I am working on a quick interface (the goal is now shot) to do some image analysis on particles.

Have large color images ~48meg so I did up load.

The flow I have in mind
Show image
I draw quick ROI
Set which color plane to work on
Set the threshold value for a manual thresholding algorithm.

I test the flow manually and all seems right with the world, but when I script it up I am getting an error: "Parameter out of range" in the imageAnalyzeParticles.

When I run manually the ROI mask is properly generated as is the Threshold mask. When I create a separate plane via matrix and use the particle analysis interface, it does show the correct features being identified.

Where have I gone wrong? I have checked the colorplane = 1 and threshold = 33.
Tried in both IP7 and IP8.


Andy

Function WMAnalyzeParticles(ctrlName):buttonControl
    string ctrlName
   
    Wave inWave=image
    ImagegenerateROIMask image
   
    wave M_ROIMask
    Variable ColorPlane, Threshold
    controlinfo pickcolor//pick color from pop up
    ColorPlane = V_Value-1

    ControlInfo ThresValue//setvariable with internal number
    Threshold = V_Value

    ImageThreshold /p=(ColorPlane) /R=M_ROIMask /M=0/i /T=(Threshold) inWave
    Wave M_ImageThresh
    ImageAnalyzeParticles /D=inWave /p=(ColorPlane) /R=M_ROIMask /W/A=4 stats M_ImageThresh//here is where the error is generated
End
   


It is difficult to guess what is going on so it would help if you ran a few quick tests to eliminate some of the possibilities. My bet is that it has something to do with the ROI mask so try to run this first without /R flag. If that is not the problem try without the /D flag. Also test with hard-wired ColorPlane argument to /P.

A.G.