Software Manual
Software Manual
Software Manual
(c) VATech
www.vatech.co.kr DR Detector Lab
Edition:Mar-2011 / Library Ver. 3.4.3.6
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.
(optional)
(Bright)
(Dark)
Offset
Gain
Cut
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 )
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
On the page “Calibration” select radio-box [Custom] and click [Get Dark].
Note: state of checkbox [Offset Calibration] does not affect dark acquisition
7
3. Calibration
3.1. Offset (Dark) Calibration
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.
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].
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%
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
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.
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]
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).
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
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
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.
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 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
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“
18
4.2. Common Features of Property Sheet’s 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
Respective combo-boxes and buttons create new chunks or delete, rename and edit existing ones.
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”)
You may exclude “Init” from acquisition sequence and invoke it as separate operation.
“Initialization” “Acquisition”
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"
21
4.3. Property Pages
Note: actual appearance of User Interface may differ from this manual.
[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”
[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)
See paragraph 4.2.5 about detector initialization modes’ names storage and buttons [New], [Rename],
[Delete], [Edit]
23
4.3.3. Page “Calibration”
[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”
[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”
26
4.3.6. Page “Calibration Preview”
%CAL%
Information about
selected frame
Locations of the
sample pixels
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
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).
30
4.4.5. Detector’s Firmware Initialization Settings
This dialog contains initialization settings
of detector’s firmware.
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].
Pixel_Max
Pixel_Min
Pixel_White
Histogram truncation in dark (in 0.1%)
Pixel_Black
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
Marker X
Marker Y
Marker type
Marker location
34
4.5.5. Marker types “R” and “C”
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
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
37