Software Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

DaVinci Detector Library

(c) VATech
www.vatech.co.kr DR Detector Lab
Edition:Mar-2011 / Library Ver. 3.4.3.6

1. Requirements and usage schemes .....................................................................................................3


1.1. Requirements............................................................................................................................3
1.2. Terms .......................................................................................................................................3
1.3. General information..................................................................................................................3
1.3.1. Program modules ..............................................................................................................3
1.3.2. Data formats .....................................................................................................................3
1.3.3. General Data flow .............................................................................................................3
1.3.4. Directories ........................................................................................................................4
1.3.5. Standard files in the calibration directory ..........................................................................4
1.3.6. Files in image-directories ..................................................................................................4
1.3.7. General Log-files ..............................................................................................................4
2. Acquisition .......................................................................................................................................7
2.1. General information..................................................................................................................7
2.2. Acquire frames within built-in UI for custom purposes .............................................................7
2.2.1. Acquire Dark Frame..........................................................................................................7
2.2.2. Acquire Bright Frame........................................................................................................7
2.2.3. Location of the acquired frames ........................................................................................7
2.3. Temporary files during acquisition for debug purposes .............................................................7
3. Calibration .......................................................................................................................................8
3.1. Offset (Dark) Calibration ..........................................................................................................8
3.1.1. Library’s implementation of the procedure........................................................................8
3.1.2. Preparation within built-in library’s UI..............................................................................8
3.2. Gain (Bright) Calibration ..........................................................................................................8
3.2.1. Library’s implementation of the procedure........................................................................8
3.2.2. Preparation within built-in library’s UI..............................................................................8
3.2.3. Considerations ..................................................................................................................9
3.3. Bad Pixels Removal................................................................................................................11
3.3.1. Library’s implementation of the procedure......................................................................11
3.3.2. Preparation of automatic Bad Pixels Map within built-in library's UI............................12
3.3.3. Preparation of manual Bad Pixels Map within built-in library' UI..................................14
3.3.4. Merge Manual and Automatic BPMs..................................................................................16
3.4. Cut a Frame to an Image .........................................................................................................16
3.5. Temporary files during calibration for debug purposes............................................................17
4. Built-in Library’s User Interface ....................................................................................................18
4.1. Property Sheet.........................................................................................................................18
4.1.1. Invoke Property Sheet ....................................................................................................18
4.1.2. Close Property Sheet ......................................................................................................18
4.2. Common Features of Property Sheet's pages .........................................................................19
4.2.1. Terminal window ............................................................................................................19
4.2.2. Button [Reset to Defaults] ..............................................................................................19
4.2.3. Button [View] .................................................................................................................19
4.2.4. Common design of Property Pages' ................................................................................19
4.2.5. Initialization profile settings' chunks ..............................................................................19

1
4.2.6. Option “Always send INIT command”............................................................................20
4.2.7. Option “Calibration dir suffix with IP” & "Setting file suffix with IP"............................20
4.3. Property Pages ........................................................................................................................22
4.3.1. Page “Settings” ...............................................................................................................22
4.3.2. Page “Acquisition”..........................................................................................................23
4.3.3. Page “Calibration” ..........................................................................................................24
4.3.4. Page “Bad Pixels Removal” ............................................................................................25
4.3.5. Page “Tests” ...................................................................................................................26
4.3.6. Page “Calibration Preview”.............................................................................................27
4.3.7. Page “About”..................................................................................................................28
4.4. Modal Dialogs ........................................................................................................................29
4.4.1. Auxiliary Calibration ......................................................................................................29
4.4.2. Auxiliary operations with RAW-files ..............................................................................29
4.4.3. Logging of acquired frames.............................................................................................29
4.4.4. Additional calibration settings .........................................................................................30
4.4.5. Detector’s Firmware Initialization Settings......................................................................31
4.4.6. Consecutive frames’ acquisition......................................................................................31
4.5. Built-in RAW-files Viewer .....................................................................................................33
4.5.1. Common controls and displayed statistics .......................................................................33
4.5.2. Mapping of 16-bits data to 8-bits display gray-scale........................................................33
4.5.3. Histogram’s presentation.................................................................................................34
4.5.4. Marker type “S” ..............................................................................................................34
4.5.5. Marker types “R” and “C”...............................................................................................35
4.5.6. Statistics of local surround ..............................................................................................35
4.5.7. Files’ mask......................................................................................................................36
4.5.8. Local menu commands....................................................................................................36
4.6. Built-in Editor of Manual BPM...............................................................................................37

2
1. Requirements and usage schemes
1.1. Requirements
Peripheral hardware: DaVinci detector connected via Ethernet card.
Note: RS232-connection with detector is not essential but desired
CPU/Motherboard: 1 GHz (or faster) CPU, cache L2>=256KB
Note: The library is optimized for motherboard with one or two Dual-Core-CPUs and large cache L2
RAM: >=512MB, 2GB recommended
Hard drive: no special requirements
Display: At least 17-inch monitor is required. 21-inch monitor is suggested.
Note: program technically works with any display but manual edit of Bad Pixel’s Map is more convenient on
large screen area.
OS: Windows 2K or XP professional
Development environment: MS Visual C++ 6.0 or MS Visual Studio 2005
Note: though binary interface of the DLL is also compatible with another Integrated Development
Environments like Borland Delphi or MS Visual Studio 2003 developer is unable to support another IDEs.

1.2. Terms
This manual uses the next terms without explanation
Detectors’ physic: offset calibration, gain calibration, flat field correction , bad (dead) pixels.
General math: simple average, moving average, median
Image processing: median filter
MS Windows controls: edit-box, check-box, radio-button, property sheet etc.
Note: this manual illustrates some library’s features (like de-speckle filters during calibration) in details (for
parameters’ adjustment) but intentionally does not explain those for full understanding.

1.3. General information

1.3.1. Program modules


The library consists of:
- Main DLL (original name VADAV.dll)
- Image viewer DLL (name View16.dll)
- Configuration ini-file (original name VADAV.ini)
- Link-file and/or bat-file to start DLL’s property sheet via standard windows utility rundll32.exe. It
must contain command line like the next “\WINDOWS\SYSTEM32\rundll32.exe C:\DaVinci\VADAV.dll
VD_Dialog” (see also paragraph 4.1.1)
Note: Configuration ini-file must coexist with DLL in the same directory and must have the same name. But
you’re able to rename them like “AnyOtherName.dll” and “AnyOtherName.ini” respectively.
“View16.dll” is fixed name

1.3.2. Data formats


All data are 16-bits (signed, little-endian) files with extension “raw” and without a header. We call data
received from detector (with original width and height) “frames”. However customers uses only part of
detector’s area after optional rotation, flip and edges’ cut. We call such data “images”.

1.3.3. General Data flow


Acquisition Calibration Image
Processing
Bad Pixels’
Removal

(optional)
(Bright)
(Dark)
Offset

Gain

Cut

Frame Frame Image Image

3
Note 1: This chart does not include some supplementary operations
Note 2:Image Processing is optional feature. It may not exist in your release of the library.

1.3.4. Directories
The library keeps all its data within its “home directory” (call it %HOME%). The path is stored in the
Configuration ini-file
[Settings]
HomeDir=C:\DaVinci\
“Calibration directory” %HOME%CAL\ contains frames (I denote it as %CAL%). The library keeps images in
directories %HOME%Iwidthxheight\. “Logging directory” %HOME%LOG\ contains log-files. (I denote it as
%LOG%).
Note: Name of %CAL% could be changed in accordance with detector’s IP address (see 4.2.7 )

1.3.5. Standard files in the calibration directory


dark.raw - recent Dark Frame; it is used every time when offset-calibration is required
Xnnnnn.raw – newly acquired Bright Frames for gain-calibration
Amm_nnnnn.raw – processed Bright Frames for calibration (Calibration Points)
BPM.raw – automatic bad pixels’ map (Automatic BPM)
BPMM.raw – manual bad pixels’ map (Manual BPM)
$a*.raw, $c*.raw – intermediate frames (for debug and adjustment, see 2.3 and 3.5)
Users are suggested to keep all frames in this directory and its subdirectories (it makes visual comparison
of the frames more convenient)

1.3.6. Files in image-directories


Files may have voluntary name (specified by user). Files $i*.raw are intermediate images from recent
image processing procedure (if the library includes image processing)). However the frames $c*.raw
could be saved as images in an image directory if the respective flag (see paragraph 5 about software
interface) is specified by the caller.
Note: Built-in library’s User Interface saves temporary calibration frames $c*.raw in the default image
directory when radio-button [Cut Image] on the page “Acquisition”(see paragraphs 4.3.2, 2.2.2) is ON.

1.3.7. General Log-files


Those are text files in the %LOG%. Log-files within built-in library’s UI have specific prefixes:
ann.log – general acquisition logs
bnn.log – logs of bright (gain) calibration
dnn.log – logs of dark (offset) calibration
ipnn.log – logs of image processing (if library includes image processing)
mnn.log – logs of automatic BPM detection
Here nn is a number. The recent log has name 00.log. Library keeps up to 10 logs of each type and
deletes older logs automatically.

Directory %LOG% may also contain acquired bright- and dark-frames (perhaps down-sampled) with names
$bnn.raw and $dnn.raw respectively if frames’ logging is enabled (see paragraph 4.4.3).

4
2. Acquisition
2.1. General information
We may acquire two kinds of frames
- Dark frame without X-ray
- Bright frame with X-ray

During acquisition detector and library communicate via Ethernet TCP.

2.2. Acquire frames within built-in UI for custom purposes

2.2.1. Acquire Dark Frame

On the page “Calibration” select radio-box [Custom] and click [Get Dark].

Note: state of checkbox [Offset Calibration] does not affect dark acquisition

2.2.2. Acquire Bright Frame

Page “Acquisition” Page “Calibration”

2.2.3. Location of the acquired frames


The library saves the acquired frames preferably in %CAL% with default extension raw. Custom name like
“my_dir/my_frame” saves file “%CAL%/my_dir/my_frame.raw”. The library also creates one-level sub-
directory “my_dir” if it does not exist yet.

2.3. Temporary files during acquisition for debug purposes


These files appear in “%CAL% when check box [Acquired Raw Frames] in group-box “Save Debug Data”
on the page “Settings” (see paragraph 4.3.1) is ON (Respective key is SaveTempAcqFrame in [Settings])
The names are $a_rawbright.raw and $a_rawdark.raw.

7
3. Calibration
3.1. Offset (Dark) Calibration

3.1.1. Library’s implementation of the procedure


Dark calibration is plain operation. Every moment when it needs the library assumes that recent dark
frame always is pre-captured and exists as %CAL%DARK.raw.
Note: more sophisticated offset calibration (for faster detectors, when frame’s capture time is insignificant)
may include two another approaches:
- Use several averaged dark frames for offset calibration
- Acquire dark frame for offset calibration after bright one. It is “physically” better in general but adds
much complexity to program and maintenance logic. The “low-level “ functions of S/W interface allow this
approach easily. Built-in library’s UI allows it too (though not in very convenient manner). But “simplified”
functions of S/W-interface do not. Usually proper “de-speckle” compensates difference between pre- and post-
captured dark-frames. But if temperature’s influence is very uneven to different ASIC’s in a detector then we may
really need post-captured dark-frames.

3.1.2. Preparation within built-in library’s UI


Button [Get Dark] on the page “Calibration” (see paragraph 4.3.3) acquires frame %CAL%DARK.raw.

3.2. Gain (Bright) Calibration

3.2.1. Library’s implementation of the procedure


It requires that %CAL% contains one or many frames (Calibration Points) named Ann_mmmmm.raw, where nn
is voluntary 2-digits prefix (just to avoid casual coincidence of file names) and mmmmm is 5-digits suffix
representing “target calibration value” for given Calibration Point. I.e. if we apply gain calibration to this
frame itself we get all pixels having the same “target calibration value”.
Note: the “target calibration value” generally is something like frame’s median value. But one is able to
modify file’s name to change that.

If %CAL% contains single Calibration Point (single frame Ann_mmmmm.raw) then library makes Flat- field
correction. If there are several calibration points then library makes Multi-point calibration (depending on
implementation it may be Linear Interpolation, Lagrange Interpolation (Neville’s algorithm) or
Polynomial Fitting (solving Vandermonde matrixes).
Note: this implementation uses Linear Interpolation.

3.2.2. Preparation within built-in library’s UI


Let’s assume that we preparing 2 calibration points from just 2 Bright Frames.

Step A. Acquire Bright Frames


1) Go page “Calibration” (see paragraph 4.3.3) and click button [Get Dark] to acquire fresh dark
frame
2) Set kVp and mA so that expected Bright Frame’s level is would be about 40% of saturation Click
button [Get Bright]. It will produce frame with name %CAL%xNNNNNA.raw, where NNNNN is median
pixel’s value within current image borders after offset calibration (cut frame edges are never used
during calibration). Suffix ‘A’ (it also could be ‘B’,’C’ etc) avoids casual coincidence of file names.
3) Click [Get Dark] and acquire fresh Dark Frame.
It may be almost identical to the recently acquired one (at step “1”). But we encourage you don’t save couple of
minutes risking accuracy of gain calibration.
4) Set kVp and mA so that expect Bright
Frame’s level would be about 80% of
saturation. Get another bright frame
(i.e.another file %CAL%xMMMMMA.raw)

8
Step B. Make Calibration Points from acquired Bright Frames
Button [Generate] will produce 2 calibration points with names “A00_NNNNN.raw” and “A01_MMMMM.raw”
respectively. Now you may delete Bright Frames xNNNNNA.raw by respective button [Purge].

[Generation] is disabled while


list of existing Calibration Points
is not empty

Note: in this example Calibration Points are identical to the Bright Frames (as we acquire one Bright Frame
for each of two Calibration Points)

If we repeat steps “2)” and “4)” several times then we respectively get several Bright Frames for each
Calibration Point. Several Bright Frames will be averaged and combined into single Calibration Point if
difference of their “target calibration value” is less than value in the edit-box [Tolerance].
Related key in the Configuration file VADAV.ini:
[Settings]
AveBrightTolerance=250

Buttons [Purge] display simplest dialog, which allows you delete single
selected frame or all frames enlisted in the list-box.

The next table contains sample automatic names (library assigns names automatically) of acquired bright
frames and calibration points
Sample names of Sample names of Calibration Points files in
Bright Frame files %CAL%. (Assume here for example that spin-edit
in %CAL%. [Tolerance] and respective key
AveBrightTolerance are “250”)
2 Calibration Points x05000A.raw A00_05000.raw
x05000B.raw A01_10000.raw
2 Bright Frames for each
x09900A.raw
point x10100A.raw
2 Calibration Points x05000A.raw A00_05000.raw
x07000A.raw A01_07000.raw
1 Bright Frame for first
x07000B.raw A02_10000.raw
point, 2 bright frames for 2nd x10000A.raw
one and 3 for 3rd one x10100A.raw
x10200A.raw

3.2.3. Considerations
Two are two important approaches beyond scope of this manual (up to customer’s decision)
- How many Calibration Points we need?
- How many bright frames of the same level (within the [Tolerance] value) we have to acquire for one
Calibration Point?
Number of Calibration Points 1 2 3
Suggested Bright Frames’ levels (relative to the 75-90% 40-45% 30%
saturation) 80-90% 60%
90%

Bright Frames’ levels (relative to the saturation) 30% 60% 90%

9
Suggested number of Bright Frames for one N about N*1.5 about N*2
Calibration Point
Value of N is up to customer. Number of Bright Frames generally has to be bigger for higher X-rays as the pixels’ noise
gets higher (either Poisson’s noise of incoming photons and noise from electronic components).

10
3.3. Bad Pixels Removal

3.3.1. Library’s implementation of the procedure


There are (at least they’re expected to exist) two frames in %CAL%:
BPM.raw: - Automatic Bad Pixels Map
BPMM.raw: - Manual Bad Pixels Map

A pixel, marked as non-zero in one of those frames, is considered as “bad” and must be replaced during
Bad Pixels Removal procedure with average of its N nearest good neighbors. In addition two de-speckle
procedures (called “Auxiliary “ and “Standalone”) correct some suspicious pixels with help of BPMs.
Note: this implementation has N=8.

Flow-chart of the procedure.


1) Load automatic and manual BPMs.
2) Skip the procedure if no one of the BPMs exists. Combine them by OR if the both BPMs exist.
3) Replace bad pixels with averages of their N nearest good neighbors.

Refer paragraph 1.3.3 for general Data Flow chart

11
3.3.4. Preparation of automatic Bad Pixels Map within built-in library’s UI
Button [Generate Auto BPM] on the page “Calibration” (see 4.3.3) creates the frame %CAL%BPM.raw.
Related keys in the Configuration file:
[BadPixMap]
DarkDevLo=100
DarkDevHi=100
NumSegs=12
BrightRDevLo=0.15
BrightRDevHi=0.15
Radius=30
Library marks a pixel as bad one when it conforms to the “bad conditions” at least in
one of the tested dark or bright frames.
In current implementation the library tests
- only one recent dark frame (file %CAL%DARK.raw)
- only existing Calibration Points (files %CAL%Ann_mmmmm.raw)

“Bad conditions” for tested dark frames when value of [# segs] is zero (when “NumSegs=0”)
- Pixel is lesser than FRAME_MEDIAN -[Low]
- Pixel is bigger than FRAME_MEDIAN+[High]
Note: it is simplest way of definition of bad pixels for dark frame when leakage current is small enough and
dark frame is homogeneous.

“Bad conditions #1” for tested dark frames when value of [# segs] >=1
- Pixel is lesser than LOCAL_HORZ_MEDIAN-[Low]*K
- Pixel is bigger than LOCAL_HORZ_MEDIAN+[High]*K
where K=2 in current implementation
or
“Bad conditions #2” for tested dark frames when value of [# segs] >=1
- Pixel is lesser than LOCAL_HORZ_MEDIAN-[Low]
Pixel is lesser than LOCAL_VERT_MEDIAN-[Low] or
- Pixel is bigger than LOCAL_HORZ_MEDIAN+[High]
Pixel is bigger than LOCAL_VERT_MEDIAN+[High]

LOCAL_HORZ_MEDIAN is calculated within RH nearest rows horizontal detectors’s segment that


contains current pixel. LOCAL_VERT_MEDIAN is counted withn RV nearest rows of the pixel’s
column. In current implementation RH=3, RV=22.

Frame_Width Frame_Height
RV

Current pixel
Seg#0 Seg#1 Seg#11
(Col, Row)

Area to calculate
RH LOCAL_VERT_MEDIAN
within current column Col
and nearest RV rows

Area to calculate
LOCAL_HORZ_MEDIAN within current
Seg#2 and nearest RH rows
Horizontal_Segment_Length =
Frame_Width / NumSegs

12
The picture above illustrates sample for “NumSegs=12”. For given current pixel with coordinates (Col,
Row) the LOCAL_HORZ_MEDIAN is calculated within green rectangular area (rectangle’s width is
Horizontal_Segment_Length columns and height is RH*2+1 rows). The LOCAL_VERT_MEDIAN is
calculated within blue segment of column Col (height of the segment is RV*2+1 rows).

“Bad conditions” for tested bright frames:


- Pixel is lesser than LOCAL_AVERAGE-Low_Lim
- Pixel value is bigger than LOCAL_AVERAGE+High_Lim
where Low_Lim= FRAME_MEDIAN*[Low]
High_Lim= FRAME_MEDIAN*[High]
LOCAL_AVERAGE is moving average of pixel’s surround within [Radius]

Note: If you open Editor of the Manual BPM see paragraph below (and
paragraph 4.6) then click menu [Reload] to refresh the view when you modify
%CAL%BPMraw.

13
3.3.5. Preparation of manual Bad Pixels Map within built-in library’s UI
When a Raw-Viewer window (see paragraph 4.5) is opened for frames (dimension coincides with native
frame) it shows button [BPM]. The button opens small control window (in the right-bottom screen corner
to edit the Manual BPM file %CAL%BPMMraw (see also paragraph 4.6).

- Currently marked bad pixels from Automatic BPM (%CAL%BPMraw) have magenta color
- Currently marked bad pixels from Manual BPM (%CAL%BPMM.raw) have light-magenta color
- Currently edited line’s segment (row or column within specified limits) has light-green color

Marker’s position (click Left mouse button)

to align edit line with the Marker’s


Edited line (use keys F11 and F12

Painting mode (click Right mouse


button)
position)

Select index of edited [row/column], first ([From]) and last ([To]) pixels and then [Fill] selected segment
(it is displayed with light-green color) with value [0-good] or [1-bad].
Button [Save] writes the Manual BPM frame to the file %CAL%BPMM.raw (or removes the file from hard-
disk if there is no one non-zero pixel the Manual BPM frame).

14
Note: I suggested huge monitor. Nevertheless if you have no option but edit manual BPM on the small monitor
then [Painting mode] becomes quite important. Painting modes [Draw keeps black] and [Draw keeps white]
preserve brightest and darkest pixels within local surround so bad pixels on the tested frame become
distinguishable even in small scale. End-user applications shall use [Draw halftone] when display images. [Draw
fast] may look similar to halftone, but solitary bad pixels are visible or not at random

Interpolation. Remove some rows and columns.

Preserve black details. Preserve white details.

15
3.3.6. Merge Manual and Automatic BPMs
Reliability of the Automatic Bad Pixels’ Detection
near frame’s edges depends on used collimator. You
may use X-ray source without collimator to expose
X-rays over whole detector’s area, then perform
Automatic Bad Pixels’ Detection and then merge
Automatic BPM with Manual one to prevent
precious data in %CAL%BPM.raw from casual
overwriting next time by Automatic Bad Pixels’
Detection.

If you do not have Manual BPM yet then simply


rename %CAL%BPM.raw to %CAL%BPMM.raw. If you
already have Manual BPM then merge
%CAL%BPM.raw with %CAL%BPMM.raw and save result
frame as %CAL%BPMM.raw. Respective dialog (see 4.4.2) is available on the page “Bad Pixels Removal” by
button [Aux Operations].

3.4. Cut a Frame to an Image


Page “Settings” (see paragraph 4.3.1) contains respective controls.
Related keys in the Configuration file:
[Settings]
FrameWidth=3144
FrameHeight=3240
ImgCutLeft=60
ImgCutTop=250
ImgCutRight=70
ImgCutBottom=100
Rotation=0 0:none 1:90_deg_CCW 2:90_deg_CW
Flip=0 0:none 1:horz 2:vert 3:horz&vert

Transformations’ order during cropping a “frame“ to an “image“ (see 1.3.2) is the


next:
1) Rotation
2) Flip
3) Cut edges
Program automatically recalculates dimension of output images [Image Width]
and [Image Height] when you change [Frame Width], [Frame Height] or
parameters of Image Cut.

Note: I specify cut parameters after all other transformation for convenience of possible “last minute”
adjustment. Designer defines flip and rotation once. But Customer-Service persons probably will often modify
edges’ cut parameters for particular collimators; and they prefer to see images in their natural orientation.

16
3.5. Temporary files during calibration for debug purposes
These files appear when check box [Temp Frames during Calibration] in group-box “Save Debug Data”
on the page “Settings” (see paragraph 4.3.1) is ON (Respective key is SaveTempCalFrames in
[Settings])

The files are


$c0_src.raw: it appears only when temporary data are saved in image directory; otherwise it is just source frame)
$c1_offset.raw: after offset calibration
$c2_gain.raw: after gain calibration
$c3_anoise.raw: after Additive-noise Removal
$c3_bpm.raw: after applying automatic and manual BPMs
$c4_destempbpm.raw: temporary BPM from auxiliary de-speckle
$c5_des.raw: after standalone de-speckle
$c6_vsmth.raw: after V-smooth

The library’s UI saves these frames in %CAL% when radio-button [Save Full Frame] on the page
“Acquisition” (see 4.3.2) is ON. The library saves these files as images in current image directory when
radio-button [Cut Images] is ON. Application programs specifies calibration logging directory of by the
flag “cVDC_FTempDirIP” (see 5.2.1 about software interface)

17
4. Built-in Library’s User Interface
4.1. Property Sheet

4.1.1. Invoke Property Sheet

You may invoke built-in Property


Sheet dialog by command line (in a
BAT- or in a LNK-file) like the next
“\WINDOWS\SYSTEM32\rundll32.exe
C:\DaVinci\VADAV.dll VD_Dialog”
or “rundll32.exe .\VADAV.dll
VD_Dialog”. Command line and
working directory may need full paths
or not (depending on Windows
environment settings).

If an error message appears when you


click supplied LNK-file then invoke
its “properties” (usually you can do it
clicking right mouse button) and
specify in [Target] and [Start-in] edit-
boxes full paths for standard windows
utility rundll32.exe and installed
DLLs.

Note: in some releases of Windows XP the command line with spaces as parameters’ separator causes
“general protection fault” at the startup (i.e. message box “access violation” appears when you run rundll32.exe
through the BAT- or LNK-file). Those systems require parameters separated by comma (character”,”) like the
next: “\WINDOWS\SYSTEM32\rundll32.exe C:\DaVinci\VADAV.dll,VD_Dialog“

4.1.2. Close Property Sheet


Button [OK] (or key “Enter”) closes Property Sheet and writes current setting in UI to the Configuration
ini-file. Button [Cancel] (or key “ESC”) closes Property Sheet without saving changes.

18
4.2. Common Features of Property Sheet’s pages

4.2.1. Terminal window


Property Sheet’s pages have Terminal window. It traces library’s messages (respective log-files duplicate
the most of messages) and communications through serial port
(when serial port is enabled). You may send simple text commands
to Linux-console when connected to the detector by serial port (like
login, password, etc). Library remembers 10 recent commands (in
section [temp serial commands] of the configuration ini-file).

Note: please use HyperTerminal or another dedicated program for


more sophisticated communications with Linux-console.

Button [Send] has shortcut key “Alt+N”. Character “<” denotes


input from serial port. Output to serial port begins with character
“>”.

4.2.2. Button [Reset to Defaults]


On each of the pages this button resets non-temporary parameter (which may affect image acquisition and
processing in customer applications) to default state.

4.2.3. Button [View]


When this button exists it opens built-in Raw-files viewer (see 4.5) for specific directory and file
dimensions. On the calibration-related pages it opens viewer for “frames” in %cal%. On the image-
processing page it opens viewer for images in %HOME%Iwidthxheight\. On the acquisition’s page it opens
“frames” or “images” depending on the current state. Page “About” contains auxiliary viewer when you
may explicitly specify file’s dimension.

4.2.4. Common design of Property Pages’

View
Terminal window
Application- and
auxiliary
operations
Terminal commands Send (specific for the
page).
You may invoke local menu by key “F9”
Settings, which or clicking right mouse button
Settings that might affect customer
affect build-in
applications.
library’s UI. [Explore] – starts explorer.exe for
Miscellaneous information. directory %HOME%.

Reset

4.2.5. Initialization profile settings’ chunks


The library saves large chunks of parameters (like parameters of detector’s initialization and image
processing) within continuously enumerated sections in the VADAV.ini. The sections have names
[Init1], [Init2]..[Init99] or [IP1], [IP2]..[IP99] etc respectively (where suffix of section’s name
denotes its index). Each section has key “Caption”, which built-in UI displays (customer software also is
able to display those captions of course). Software Interface never uses the “captions” but refers the
indexes.
19
[Init1]
Caption=Mode 1
<blah-blah>
[Init2]
Caption=Mode 2
<blah-blah>

Respective combo-boxes and buttons create new chunks or delete, rename and edit existing ones.

4.2.6. Option “Always send INIT command”


Option “Always send INIT command” in local pup-up menu (which is available by Right mouse button
click or by key “F9”). The respective key in configuration file is “SendInitAlways” in section [Settings]

By default “SendInitAlways=1”. When you click “acquisition buttons” ([Get Dark], [Get Bright] or
[Acquire]) the library’s UI performs the next sequence of operations (“Initialization and Acquisition”)

Connect Init Acquire data Close

You may exclude “Init” from acquisition sequence and invoke it as separate operation.
“Initialization” “Acquisition”

Connect Init Close Connect Acquire data Close

Button [Init] becomes visible when “SendInitAlways=0” In this case the “acquisition buttons” do not
send init commands.

IMPORTANT note: if you enable this option you should manually control initialization/acquisition for dark-
bright frame in the initialization dialog (see paragraph 4.4.5). Initialization with [Dark] ON must precede any dark
frame acquisition. Initialization with [Dark] OFF must precede any acquisition of bright frame. When this option is
disabled library initializes dark/bright acquisition automatically and setting of checkbox [Dark] is simply never
used.

4.2.7. Option “Calibration dir suffix with IP” & "Setting file suffix with IP"
This option simplifies simultaneous connection
of several detectors with different IP using
the same configuration ini-file.
The library could automatically associate
the last two octets of IP-address with the suffix
the calibration directory’s name. It reflects
flag key "CalibDirWithIP"/"IniFileWithIni"
in section[Settings] of the configuration
INI-file.

Default: "CalibDirWithIP=0"
Calibration directory is “%HOME%CAL\*.*”
Default: "IniFileWithIP=0"
IniFileWithIP is "vadav.ini"
(regardless to Sensor IP address)

20
“CalibDirWithIP=1”
If Sensor IP address is “N1.N2.N3.N4”
then %CAL% has name
“%HOME%CAL_N3_N4\*.*”
"IniFileWithIP=1"
"vadav_N3_N4.ini"

If you check and modify vadav_N3_N4.ini,


select sensor IP address and then click load
button.

You’re able to modify this key by respective


command in local pup-up menu.

21
4.3. Property Pages
Note: actual appearance of User Interface may differ from this manual.

4.3.1. Page “Settings”

See paragraph 3.4 about image/frame dimensions and cut.

[Detector Type] :
[Default IP] : Current Sensor IP is set ot the default IP when using several detectors.
(refer paragraph 4.2.7)
[Sensor IP]: predefined IP-address of the detector.
[Port]: serial port (“none” disables RS-232 communications)
[Number of Parallel Threads]: suggested value is from 1 (in simple Pentium 4 with moderate cache
L2) up to 4 in system on dual Xeon
[Relaxation time between Acquisitions] – minimum delay after end of acquisition before start next
acquisition in milliseconds. ([Settings] key “RelaxationTime“).
[Browse]: modifies %HOME%.
[Open]: opens VADAV.INI in notepad.
Save [Acquired RAW Frames]: %CAL\$a_rawbright.raw or %CAL\$a_rawdark.raw.
Save [Temp Frames during Calibration]: files $c*.raw in %CAL% or in current image directory
%HOME%Iwidthxheight.
Save [Temp Images during Process]: files $i*.raw in current image directory %HOME%Iwidthxheight.
Note: of course only if image-processing option exists.

22
4.3.2. Page “Acquisition”

See paragraph 1.3.7 about log-files.


Note: double-click upon name of a log-file’s will open it in Notepad.

[Acquire New] – acquire new frame


[Use Existing] – select a frame from hard-drive (preferably in %CAL%)
[Offset Calibration] – enable offset calibration (refer paragraph 3.1)
[Gain Calibration] – enable gain calibration (refer paragraph 3.2)
[Bad Pix Map] - enable bad pix map (refer paragraph 3.3)

[Cut image] – save result as image (in the current image directory %HOME%Iwidthxheight\ preferably).
Refer paragraphs 1.3.2, 1.3.4 and 3.4.
[Save Full Frame] – save result as frame (in %CAL% preferably)

[Logging] – see paragraph 4.4.3 about logging of acquired frames.

See paragraph 4.2.5 about detector initialization modes’ names storage and buttons [New], [Rename],
[Delete], [Edit]

23
4.3.3. Page “Calibration”

Refer paragraph 3.1 about Offset calibration.


See paragraph 3.2.2 about preparation of the Calibration points.
See paragraph 4.2.5 about detector initialization modes’ names and storage and buttons [New], [Rename],
[Delete], [Edit]

[Calibration] – acquire bright or dark frame for built-in library’s calibration (refer paragraph 3)
[Custom] – acquire a frame for custom purpose with voluntary name (preferably in %CAL%)

[Offset Calibration] – enable offset calibration (for custom bright frames only; otherwise this check-box
is ignored)

[Consecutive acquisition] – Acquire and then average several frames (see paragraph 4.4.6)
[Aux Calibration] – Auxiliary Calibration dialog (see paragraph 4.4.1)
[Aux Operations] – Auxiliary operations upon raw-files (see paragraph 4.4.2)

24
4.3.4. Page “Bad Pixels Removal”

Refer paragraph 3.3 about Bad Pixels Removal.


See paragraph 3.3.2 about preparation of Automatic Bad Pixels Map.
See paragraph 3.3.3 about preparation of Manual Bad Pixels Map.

[Auto Bad Pixels Map] – displays date & time of creation of %CAL%BPM.raw (if the file exists)
[Manual Bad Pixels Map] – displays date & time of creation of %CAL%BPMM.raw (if the file exists)
[Aux Operations] – Auxiliary operations upon raw-files (see paragraph 4.4.2)

25
4.3.5. Page “Auxiliary”

[Get Test Pattern] - returns detector pattern and save it as “%CAL%/SpecialFrame.raw”


[Get Recent Frame] - returns recently acquired frame and save it as “%CAL%/SpecialFrame.raw”
*[LED Test] - state of panel’s LED indicators (1:ON, 0:OFF)
*[Versions] - text strings that indicates versions of detector components *
*[EL-status] - refer firmware documentation
*[EL-Amend] - refer firmware documentation
*[Panel Status] - refer firmware documentation
*[Test Communications] - test PC<=>detector communications on detector’s side
*[Reboot] - reboot firmware (same effect as you switch detector’s power OFF and then ON)
*[Restore Connecting] - restore connection between DaVinci Detector Library and Detector
*[Acquisition Count] - count the total acquisition number
*[Get Init&EL Settings] - returns current firmware initialization settings (see 4.4.5)
[Small feedback image] - defines dimensions of secondary image returned by “EL-status”, “EL-test” and
“Panel”.
Note: * functions is only available for LTX240/LLX240.

26
4.3.6. Page “Calibration Preview”

%CAL%

Information about
selected frame
Locations of the
sample pixels

Display chart of the


transfer functions

This page provides:


- fast and simple preview (in small zoom) of frames in %CAL%
- chart of current calibration points for sample selected pixels (for visual estimation of the “transfer
function” of the selected pixels)
Definitions:
“Pixel_black” –this value is displayed as RGB(0,0,0)
“Pixel_white” –this value is displayed as RGB(255,255,255)
[Auto] – use auto contrast
[Min] –“Pixel_black” is cut of N percents from the bottom of histogram <in 0.1%>
[Max] –“Pixel_white” is cut of N percents from the top of histogram <in 0.1%>
[Fixed] – explicit specification of “Pixel_black” and “Pixel_white”
[Min] –“Pixel_black”
[Max] –“Pixel_white”

[Show Chart] – display charts of the “transfer functions”


[Gamut] – min & max input/output on the charts
[Gamut]
This chart displays currently selected sample pixels in the calibration
points (files %CAL%Ann_mmmmm.raw), see also paragraph 3.2 about “Gain
calibration”)

27
4.3.7. Page “About”
It contains controls to invoke built-in RAW-viewer (see paragraph 4.5) and dialog for auxiliary operations
(see paragraph 4.4.2) with explicit file dimensions.

28
4.4. Modal Dialogs

4.4.1. Auxiliary Calibration


The main purpose of this dialog is to
get frame %CAL%xNNNNNA.raw for
Bright Calibration Preparation (see
3.2.2) from custom flat bright- and
dark- frame. And A-noise Removal Test.
To do this set checkbox
[Automatic Result Name] ON. You
may also apply offset calibration to any
two frames for custom purposes.

4.4.2. Auxiliary operations with RAW-files


This dialog has the 3 purposes:
1) To help with preparation of the
Manual BPM (see 3.3.4)
2) To subtract one frame from
another (similar to offset
calibration) to visually check
differences between two frames
3) Add constant value to convert
frames between 16-bits signed and
16-bits unsigned presentation
(used by Photoshop for example)

4.4.3. Logging of acquired frames

Dumps all acquired dark frames as


%LOG%dnn.raw and all bright frames as
%LOG%bnn.raw. Dumped frames dimension will
be down-sampled [Dimension’s Down-Scale]
times. When parameters [Keep N Recent
frames] is zero logging does not occurs.

29
4.4.4. Additional calibration settings
This dialog is available by the button
[Change Parameters] on the page
“Calibration” (see paragraph 4.3.3).

Couple [Saturation/Replacement pixels


values] alters gain-calibration:. It
replaces all pixels bigger than
[Saturation] with [Replacement].

To detect saturation and replacement values


automatically, you can use the [Auto Mode].
After finish Calibration and BPM
(see Paragraph 3).
Enable [Auto Mode] then 'Get image'
on 'Acqusition section' (see Paragraph 4.3.2).
You can find changed saturation value'
After this work, you should disalbe
[Auto Mode].

30
4.4.5. Detector’s Firmware Initialization Settings
This dialog contains initialization settings
of detector’s firmware.

You can access this dialog by the button


[Edit] from the property pages
“Acquisition” (see paragraph 4.3.2) and
“Calibration” (see paragraph 4.3.3)

See also paragraph 4.2.5 about detector


initialization modes’ names and storage.

Note 1: Here is only a sample. This dialog


may have a lot of last-minute changes to
conform your hardware & firmware. Please
refer detector’s manual for comments.

Note 2:See “Always send Init”


(paragraph 4.2.6) about role of the checkbox
[Dark] in current implementation.

4.4.6. Consecutive frames’ acquisition


The purpose of this dialog is to acquire averaged
dark- or bright-frames. Its functionality is similar
to the buttons [Get Bright] and [Get Dark] on the
page “Calibration” (see chapter 2 and paragraph
4.3.3)

Averaging of dark frames usually does not give


significant reduction of SNR in calibrated images
(because bright frames used in calibration have
much bigger noise and an “improvement “of the
dark frame is simply invisible after gain-
calibration). This dialog is available form property page the “Calibration”

[Skip frames] – number of initial skipped frames M.


[Average frames] – number averaged frames N.
[Ok] – close dialog and remember current temporary settings for this dialog in the configuration ini-file
(section [Multiple Frames Acquisition])
[Cancel] – close dialog

31
If radio-button [Calibration] is ON then acquired frame will have standard name dark.raw or
Amm_nnnnn.raw (see 1.3.5). If radio-button [Custom] is ON then you’re able to specify voluntary name
for acquired frame (see 2.2)

Sequence of operations
Connect
Send INIT (only if SendInitAlways=0, see 4.2.6)
Skipped frames Acquire frame #1 and skip

Acquire frame #M and skip
Averaged frames Acquire frame # M +1 and sum it

Acquire frame #M +N and sum it
Calculate simple average of N acquired frames and save result

32
4.5. Built-in RAW-files Viewer
Frame- and image-files have extension “raw” and contain pixel data in signed 16-bits little-endian format.
One could view those files in Photoshop or another image editor. See also paragraph 3.3.3 for topics
related to Manual BPM and button [BPM].

4.5.1. Common controls and displayed statistics

Pixel_Min – minimum pixel value


in frame- or image-data
Open file
Pixel_Max – maximum pixel value
Delete selected file<s>
Browse dialog
Pixel_Black – if a pixel<=
Save file as BMP
Pixel_Black then it is displayed as
black (RGB(0,0,0))

Pixel_White Pixel_White – if a pixel>=


Pixel_Black Pixel_White then it is displayed as
white (RGB(255,255,255))

Pixel_Max

Simple average of frame pixels

Median value of frames’ pixels

Pixel_Min

4.5.2. Mapping of 16-bits data to 8-bits display gray-scale


You may select gray values’ mapping by histogram or by absolute values.

Histogram truncation in bright (in 0.1%)

Pixel_White
Histogram truncation in dark (in 0.1%)

Pixel_Black

Select display window by


histogram truncation or by
absolute pixels’ values

Example A. Example B.
In the Example A we specify Pixel_Black and Pixel_White explicitly. In the Example B viewer calculates
Pixel_Black and Pixel_White by cutting histogram.

33
4.5.3. Histogram’s presentation

Relative Histogram Scale [H]=1000


means that that the distance depicted
as “h” on the drawing matches 1%
of total number of pixels.
Respectively [H]=100 means that
“h” matches 0.1% of pixels and
[H]=500 means that “h” matches
Relative Histogram Scale 0.5% of pixels.

Histogram Chart Maximum Displayed Value

Histogram Chart Minimum Displayed Value

4.5.4. Marker type “S”

Displays local surround 7x11 pixels


around marker’s position

Marker X

Marker Y

Marker type

Marker location

34
4.5.5. Marker types “R” and “C”

Display profile chart of a row or a


Min displayed value Max displayed value column.

Statistics for pixels from


Ifirst to Ilast.

First index Ifirst


Last index Ilast

4.5.6. Statistics of local surround

h
r w

Simple integer number “r” as “marker type” displays statistic of circle surround with given radius
(minimal value for “r” is 3). String “wxh” displays statistics of rectangular surround. You may specify w
and h as zeros to see statistics of segment of single line.
Information about the local surround includes average, standard: deviation, max and min value within
surround and value of current pixel (in the center of surround). Left digit displays absolute value and right
digit displays position of the absolute value on the image’s histogram in percents

35
Image histogram

A B

Min Absolute Value (0%) Absolute Value V Max Absolute Value (100%)

Position of the specified absolute value V on the image’s histogram is defined as the next
Area_of_figure_A
Position_on_Histogram = -----------------------------------
Area_of_figure_A + Area_of_figure_B

Area_of_figure_A is number of image’s pixels that are <V, and Area_of_figure_B is number of pixels
that are >=V. Position_on_histogram is zero for minimum image’s pixel and 100% for maximum one

4.5.7. Files’ mask


This library requires file-mask in the next format: “widthxheight / wildcard”
For example
“3144x3240 / C:\DaVinci\CAL1\*.raw”
“2944x3040 / C:\DaVinci\I2944x3040\*.raw”
When you type dimension the library tries to guess file’s size automatically. If it is inconvenient then
disable option [File Dim Autocomplete] in the local menu. (see next paragraph).

4.5.8. Local menu commands

Frame edges Local menu appears by Right mouse


(image area after button click or by key “F9”
cut frame)
Stretching options (affect when zoom is
small enough so single display’s pixel
represents more than one real image pixel)
[Draw halftone] – interpolation
[Draw fast] – remove some
rows/columns
[Draw keeps Black] – combine
stretched pixels by “AND”
[Draw keeps White] – combine
stretched pixels by “OR”

[Explore] – start Windows Explorer

36
4.6. Built-in Editor of Manual BPM
It edits lines of %CAL%BPMM.raw.

[Pixel] - select “0” to mark good pixels or “1” to mark bad ones.
[row/column] – direction of edited line
[From], [To] – the first and the last edited pixels
[Fill] – fill edited line with specified value “0” or “1”
[Save] – write %CAL%BPMM.raw to hard-disk
Note: if there is no one marked bad pixel it simply deletes the file
from disk

Local menu appears by right mouse button click or by key “F9”.


[Clear all] – mark all as ”0” (good)
[Reload] – reload %CAL%BPMM.raw from hard-disk
[Info] - displays information about current state of the BPM’s .

“auto-detect” – number of bad pixel in %CAL%BPM.raw


“man -initial” – number of bad pixel in %CAL%BPMM.raw (as it
was loaded from disk)
“man -currently” – number of bad pixel incurrent state manual
BPM (in computer’s memory)
“total count” – total number of bad pixels
“duplicated” – number of bad pixels market both in
%CAL%BPM.raw and in current manual BPM

Local menu of the built-in Image


Viewer contains two useful
commands for manual BPM-editor

[BPM mark primary] (or key “F11” )


- sets current line index and value
[From] as current marker position.

[BPM mark secondary] (or key


“F12” ) - sets value [То] as current
marker position.

37

You might also like