ImagePro>Re: IpBlbGet(GETRANGESTATS . . .)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ImagePro>Re: IpBlbGet(GETRANGESTATS . . .)?
- To: <imagepro-users[at]lists.mediacy.com> (Image-Pro Plus Users Email List)
- Subject: ImagePro>Re: IpBlbGet(GETRANGESTATS . . .)?
- From: "Kevin Ryan" <kevin[at]mediacy.com>
- Date: Wed, 12 Dec 2001 16:43:30 -0500
- List-Archive: <http://lists.mediacy.com:80/Lists/imagepro-users/List.html>
- List-Unsubscribe: <mailto:imagepro-users-off@lists.mediacy.com>
- Reply-To: <imagepro-users[at]lists.mediacy.com> (Image-Pro Plus Users Email List)
- Sender: <imagepro-users[at]lists.mediacy.com> (Image-Pro Plus Users Email List)
GETRANGESTATS is implemented (at least in 4.5), and works as demonstrated
below to get measurement statistics on a per-class basis.
To extract the color range specific data for a particular measurement, use
something like the following macro. I applied this to the results of the
demonstration "Measure Stain" macro to test with three classes, and it works
quite well.
The documentation may not be totally clear: using GETRANGESTATS, parameter 1
is the range for which you wish statistics, parameter 2 is the measurement
to get statistics for, and parameter 3 is the Single array to receive the
information.
-- Kevin Ryan
kevin@mediacy.com
Sub Get_Range_Stats()
Dim stats(0 To 9) As Single
Dim i As Integer
Dim measure As Integer
measure = BLBM_AREA
' Get total stats for all color ranges
ret = IpBlbGet(GETRANGESTATS, 0, measure, stats(0))
If ret = IPCERR_NONE Then
Debug.Print "Range 0 - all objects"
For i=0 To 9
Debug.Print stats(i)
Next i
End If
ret = IpBlbGet(GETRANGESTATS, 1, measure, stats(0))
If ret = IPCERR_NONE Then
Debug.Print "Range 1"
For i=0 To 9
Debug.Print stats(i)
Next i
End If
ret = IpBlbGet(GETRANGESTATS, 2, measure, stats(0))
If ret = IPCERR_NONE Then
Debug.Print "Range 2"
For i=0 To 9
Debug.Print stats(i)
Next i
End If
ret = IpBlbGet(GETRANGESTATS, 3, measure, stats(0))
If ret = IPCERR_NONE Then
Debug.Print "Range 3"
For i=0 To 9
Debug.Print stats(i)
Next i
End If
End Sub
> -----Original Message-----
> From: Image-Pro Plus Users Email List
> [mailto:imagepro-users@lists.mediacy.com]On Behalf Of Anderson, Brian D
> (AS)
> Sent: Wednesday, December 12, 2001 3:15 PM
> To: Image-Pro Plus Users Email List
> Subject: ImagePro>IpBlbGet(GETRANGESTATS . . .)?
>
>
> Hi,
>
> I was just wondering if this function has been added to
> image-pro. I was
> in need of obtaining the measurement statistics for different
> color ranges,
> and was having problems. I did a search on the list and found the
> following. I'd like to know if this has been added, and I missed it . . .
> or if it is still being worked on. Thanks . . . and a big thumbs
> up to this
> list, and the searchable archive . . . they've come in very handy.
>
> -Brian Anderson
>
>
> Jean-Paul Martin" <jp@mediacy.com> writes:
>
> Aryeh,
>
> In IPP 4.0, the class number argument in IpBlbGet refers to the
> classes found by the two measurement-based classification
> functions in Count/Size: Auto-Classification and Single Variable
> Classification. It does not refer to the intensity or color
> range number.
>
> For all its worth, IPP 4.0 allows you to display both the Range
> Statistics table and the classification table. This was made
> possible by separating the range number from the class number.
> IPP 3.0 did not allow you to do so, and class numbers were
> overwritten by range numbers when Range Statistics were
> displayed.
>
> Until we release a new version of IpBlbGet with a new command
> (GETRANGESTATS) to get the range statistics, you can use Data
> Collector as Lou suggested, or you can call the macro below (For
> IPP4.0/IPBasic only):
>
> Jean-Paul Martin.
>
> Type BLOBSTATS
> Min As Single
> Max As Single
> Range As Single
> Sum As Single
> Mean As Single
> StdDev As Single
> tagmin As Integer
> tagmax As Integer
> Count As Integer
> End Type
>
> ' Low level function called by IPP to get statistics.
> ' Declaration must remain on one single line.
> Declare Function BlbControl& Lib "halblb32" (ByVal hblob%, ByVal
> blbcmd%, ByVal objid%, ByVal lParam&, lpParam As Any)
>
> ' This function gets intensity range statistics
> ' rangeId: 0-based range number
> ' rstats: array of at least 9 singles
> ' return: 0 if success, -1 if failed
> Function RangeStats(ByVal rangeId%, rstats!()) As Integer
> RangeStats = -1
> ' check there is a count and that rangeId is correct
> Dim numranges%
> ret = IpBlbGet(GETNUMRANGES, 0, 0, numranges)
> If RangeId < 0 Or RangeId >= numranges Then Exit Function
> ' set active range
> ret = IpBlbRange(rangeId)
> ' get blob environment for active range
> Dim hblob&
> ret = IpBlbGet(GETHBLOB, 0, 0, hblob)
> ' get stats
> Dim bstats As BLOBSTATS
> ret = BlbControl(hblob, 10, 0, 0, bstats)
> rstats(0) = bstats.Mean : rstats(1) = bstats.StdDev
> rstats(2) = bstats.Min : rstats(3) = bstats.Max
> rstats(4) = bstats.Range : rstats(5) = bstats.Sum
> rstats(6) = bstats.tagmin : rstats(7) = bstats.tagmax
> rstats(8) = bstats.Count
> ' reset active range
> ret = IpBlbRange(0)
> RangeStats = 0
> End Function
>
> ' example macro using RangeStats()
> Sub Get_Range_Stats()
> Dim stats(10) As Single
> ' ask stats for second range
> ret = RangeStats(1, stats)
> If ret < 0 Then Exit Sub
> ' display mean value
> Debug.Print stats(0)
> '...
> End Sub
>
> ***********************************************************
> Need an Image-Pro macro or driver? Find it at
http://www.Solutions-Zone.com
Got an Image-Pro macro or driver? Add it to http://www.Solutions-Zone.com
***********************************************************
This message is sent to you because you are subscribed to
<imagepro-users@lists.mediacy.com>.
To unsubscribe, email to: <imagepro-users-off@lists.mediacy.com>
To switch to the DIGEST mode, email to
<imagepro-users-digest@lists.mediacy.com>
To switch to the INDEX mode, email to
<imagepro-users-index@lists.mediacy.com>
Send administrative queries to <imagepro-users-request@lists.mediacy.com>
To subscribe or unsubscribe visit
http://www.solutions-zone.com/ipednld/subscriber.asp
***********************************************************
Need an Image-Pro macro or driver? Find it at http://www.Solutions-Zone.com
Got an Image-Pro macro or driver? Add it to http://www.Solutions-Zone.com
***********************************************************
This message is sent to you because you are subscribed to <imagepro-users@lists.mediacy.com>.
To unsubscribe, email to: <imagepro-users-off@lists.mediacy.com>
To switch to the DIGEST mode, email to <imagepro-users-digest@lists.mediacy.com>
To switch to the INDEX mode, email to <imagepro-users-index@lists.mediacy.com>
Send administrative queries to <imagepro-users-request@lists.mediacy.com>
To subscribe or unsubscribe visit http://www.solutions-zone.com/ipednld/subscriber.asp