CImExtract:Extract
The Extract method of the CImExtract class performs "source extraction" on an image by identifying separated sources and then computing more than 40 properties in both coordinate space and intensity space. These properties include the mean x,y coordinates, mean value and standard deviation, axis of elongation, and others. The extraction process is highly configurable and may involve any combination of background compensation, thresholded pixel collection, and property filtering using criteria such as maximum area, minimum elongation, and so on. The process is driven by a configuration with default properties which may be changed using the ImExtractParams table.
Extraction creates a table of properties for each source that is held within the CImExtract object. After extraction, the properties may be fetched from by passing their table index to GetSource. See the Mira User's Guide for more information under the main topic Extracting Sources from Images.
bSuccess = CImExtract:Extract( Image_obj ) |
where Image_obj is a CImage class object containing an image. The image may be displayed or opened from a file without display.
On success, true is returned.
Suppose an image window exists on the Mira screen. The script below performs source extraction on an image from this window and then lists the (x,y) coordinates for the first 3 sources. The default configuration is updated using a CImExtractParams table. Note that your table does not need to be named Params.
|
-- attach an image window |
|
-- leave script if no image window |
|
|
|
-- get the top-most or only image |
|
-- leave script if no image |
|
|
|
-- create a CImExtract object |
|
-- setup an ImExtractParams table |
|
-- use a comma after each "name=value" pair |
|
|
|
|
|
|
|
|
|
|
|
|
|
-- threshold value = 45 |
|
-- use pixels greater than or equal to threshold |
|
|
|
-- set new configuration properties |
|
|
|
-- extract sources from image I |
|
|
|
|
-- report the number of sources extracted: |
|
|
|
|
|
|
|
|
|
-- list the x,y coordinates for all sources: |
|
|
|
|
|
|
-- fetch the properties of source i |
|
|
CImExtract class, GetSource, ImExtractParams table
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.