Using "Rings" property

Discussion in 'Scripting and Programming' started by Richard S Post, Dec 1, 2014.

  1. Richard S Post

    Richard S Post Cyanogen Customer

    Joined:
    Oct 11, 2014
    Messages:
    49
    I am attempting to set the "Rings" property for the CalcInformation method in a program.

    The Help file ("Scripting", "Document Methods", "CalcInformation") says:

    Variant Rings - If specified, must be an array of three or four integers denoting:

    Rings(0) - Radius of central aperture

    Rings(1) - Width of gap between aperture and annulus

    Rings(2) - Width of annulus

    Rings(3) - Image plane for which measurement is to be determined. This must be zero for a monochrome image;

    for a color image it can be 1, 2 or 3 to specify the red, green, or blue planes respectively,

    or 0 to return an average of the results from all three planes.

    The first three quantities must be within the limits of the minimum and maximum values shown for the respective

    quantities on MaxIm DL's context menu. If Rings is omitted, the current rings cursor dimensions are used.

    If Rings is present but is only three elements long, the image plane selector is taken to be zero.

    The range of the first three quantities are not specified but in the User Interface, they are:

    Central Aperture - Between 2 and 20

    Gap Width - Between 0 and 30

    Annulus Thickness - Between 2 and 12

    Here is a code segment which is having problems using the "Rings" property:

    Thanks, Dick
    ' Dimension the Rings as an array of three integers

    Dim Rings(3) as Integer

    ' set them to values that are in-range per the GUI for this object in MDL

    Rings(0) = 10

    Rings(1) = 3

    Rings(2) = 4

    ' measure at a valid location in the image (declared and loaded prior to this code segment) and store the result

    Result = Image_A.CalcInformation( X, Y, Rings)

    This last statement throws an exception no matter what I try. The exception says:

    System.Runtime.InteropServices.COMException(0x0000FFFF): Rings argument must be array of 3 or 4 integers within specific limits.

    I have tried many variations on this code including:

    Dim Rings(3)

    Dim Rings(3) as Integer

    Dim Rings(3) as VariantType

    Also I've tried various values for the three Ring elements. Nothing works. I always get the same exception.

    If I do not pass Rings in the argument list to CalcInformation and manually set the rings to (10,3,4) then all is well.

    Why?
     
  2. Bob Denny

    Bob Denny Cyanogen Customer

    Joined:
    Oct 12, 2014
    Messages:
    801
    Location:
    DC-3 Dreams, SP, Mesa, Arizona +1 480 396 9700
    VB ugh. Dim Rings(3) means an array with four elements [0..3]. The fourth element is probably zero, which should not cause a problem but I can't see all of your code. Try Dim Rings(2) for starters.
     
  3. Richard S Post

    Richard S Post Cyanogen Customer

    Joined:
    Oct 11, 2014
    Messages:
    49
    Hi Bob, thanks for your reply!

    I just tried using Dim Rings(2). In Visual Studio, it now shows 3 elements and it allowed programming the 3rd element which should actually be out-of-range. But when CalcInformation is run, I get the same exception thrown.

    This is all the code there is. Nothing is missing. I simply declare the Rings array, set the values and invoke CalcInformation on a valid point in an image. The only code you're not seeing it the declaration of the image and loading a FITS file into it. This works fine.

    There are two possible problems here, one would be the declaration which you're homing in on and the other is the values in the array. They only say the values must be "within specific limits" which is not very helpful. What are the limits?

    Thanks, Dick
     
  4. Bob Denny

    Bob Denny Cyanogen Customer

    Joined:
    Oct 12, 2014
    Messages:
    801
    Location:
    DC-3 Dreams, SP, Mesa, Arizona +1 480 396 9700
    They will have to help you now. The limits are only visible in their code. I suspect you're hitting a limit.
     
  5. Adam Robichaud

    Adam Robichaud Staff Member

    Joined:
    Sep 29, 2014
    Messages:
    776
    Location:
    Ottawa
    Hi Dick,

    The hard limits of the rings values are:
    Central aperture radius (param 0): [2, 20]
    Gap width (param 1): [0, 30]
    Annulus radius (param 2): [1, 12]
    Plane (param 3): 0 if monochrome, [0, 3] if tricolor.

    As mentioned in the help file, these limits can be found in the context menu's "Set Aperture Radius", "Set Gap Width", and "Set Annulus Thickness" entries respectively. Your supplied values seem to fall within the allowed limits.

    Cheers,
    -Adam
     

Share This Page