DEVELOPMENT
OF SOFTWARE
FOR CREATION OF
GEOMETRIC MEAN IMAGES
AND
INVESTIGATION OF
APPLICATIONS IN
RENOGRAPHY
THESIS FOR MASTER OF SCIENCE IN
MEDICAL RADIATION PHYSICS, 20 P
AUTHOR: ALBERT OLSSON
SUPERVISOR: PER-OLOF SCHNELL, SENIOR HOSPITAL
PHYSICIST
DEPARTMENT FOR NUCLEAR MEDICINE AT THE
KAROLINSKA HOSPITAL, SOLNA
2
STOCKHOLM 2005
3
CONTENTS
1. INTRODUCTION ............................................................................................................... 4
1.1. Clinical background..................................................................................................... 4
1.2. Conventional methods.................................................................................................. 6
1.3. Geometric mean method.............................................................................................. 7
1.4. Related studies………………………………………………………………………..7
2. MATERIALS AND METHODS........................................................................................ 9
2.1. Gamma camera ............................................................................................................ 9
2.2. Evaluation station and programming environment.................................................. 9
3. RESULTS ............................................................................................................................. 9
3.1. Properties of the program ........................................................................................... 9
3.2. Program code in words .............................................................................................. 10
3.3. Phantom measurements............................................................................................. 14
3.4. Simulations.................................................................................................................. 16
3.5. Clinical examinations................................................................................................. 20
4. DISCUSSION..................................................................................................................... 20
4.1. Disadvantages ............................................................................................................. 20
4.2. Possible areas of use ................................................................................................... 20
4.3. Method for determination of accuracy..................................................................... 21
4.4. Absolute activity ......................................................................................................... 22
5. CONCLUSION .................................................................................................................. 22
6. REFERENCES .................................................................................................................. 23
7. ABSTRACT ....................................................................................................................... 24
APPENDIX 1, Program code for Geo_Mean_Fusion ……………………………………22
APPENDIX 2, Clinical example ………………………………………...…………………30
4
INTRODUCTION
1.1. Clinical background
The main purpose of this work is to create a computer program for creation of geometric
mean images. The second purpose is to investigate possible advantages in using two
gamma camera heads, one posterior and one anterior, when determining the relative
kidney function compared to the traditional method with only a posterior gamma camera
head.
Renography means description of the kidney function. In the Department for Nuclear
Medicine at the Karolinska Hospital, Solna, renographic studies are performed using a
double head gamma camera (Hawk-Eye manufactured by General Electrics, GE). The
purpose of renography can be to determine the difference in function between the left and
the right kidney, as a confirmation or exclusion of renovascular hypertension as well as a
control of unilateral kidney disease. For example one can study a suspected obstruction in
the urine flow from the kidneys or in an early stage be able to point out the function of a
damaged kidney or some other effect on the parenchyma due to repeated urethra
infections. For these kinds of examinations it is crucial to know the distribution of activity
and function between the kidneys.
Before getting into the scope of this paper it is necessary to explain the present method for
determination of activity distribution between the kidneys.
Hawk-Eye has two camera heads but at present only one of the heads is used during the
examination. This head is placed as close as possible to the patient’s back as possible. The
patient is lying on the back so the camera head is thus positioned beneath the patient, with
the carbon fibre bunk between the patient and the camera head. MAG3 (Mercapto-acetyltriglycin) labelled with Tc99m is used as the tracer. MAG3 is bolus injected intravenously
while the patient is lying on the bunk. The camera will record the subsequent uptake in
intervals of 10 seconds during 20 to 40 minutes. The resultant image set is sent in DICOM
format to an evaluation station. Here regions of interest, ROIs, are drawn around the
kidneys. To correct for background radiation there are different methods available. Often
one divides the background into two parts. Firstly the intra renal background, i.e. the
background originating from the kidney itself, can be represented by the activity over the
heart. Secondly the extra renal background, which is originating in the volumes in front
5
and behind the kidney, can be represented by a thin ROI around the kidney. The quality of
the background correction affects the result, particularly in case of a poor kidney function.
However, this is not relevant in this paper. This work intends to minimise the deterioration
of the result due to differences in kidney depths.
When the background corrected activities are created for all time intervals there are two
different methods to determine the relative kidney function. The first one is called the
integral-method. Clearance is defined as the volume of blood cleared of the radiotracer
per unit time. While the clearance is proportional to the activity we get
Cldx
Adx (t )
=
(Cldx + Clsin ) ( Adx (t ) + Asin (t ))
and while the activity is proportional to the count rate, R (if the kidneys are at the same
depth) we get
Cldx
Rdx (t )
=
(Cldx + Clsin ) ( Rdx (t ) + Rsin (t ))
To increase the statistics, R can be the integral of the count rate for all time intervals
during the uptake phase in respectively kidney. Thus, the integral of the curve over the
uptake phase represent the relative clearance.
The other method is called the slope method. The activity change is proportional to the
clearance times the mean concentration of all blood plasma at the same time (Cp), which is
represented by the heart activity.
[ ]
dA ⎡ Bq ⎤
~ Cl l ⋅ C p (t ) ⎡ Bq ⎤
s
s
⎢
⎥
⎢⎣ l ⎥⎦
⎣
⎦
dt
This means that the clearance is proportional to the slope of the curve over the kidney
activity, k divided by the heart activity.
6
Cldx
kdx (t )
=
(Cldx + Clsin ) (kdx (t ) + ksin (t ))
No matter what method is used, any difference in coronal position between the right and
the left kidney will cause an inaccurate result. Inaccurate means throughout this paper that
the result does not reflect the true distribution of kidney function in terms of clearance.
Any deviation, larger than what would be the case if the kidneys were located at the exact
same depth, will be referred to as an inaccuracy.
The attenuation factor is given by f attenuation = e − μ ⋅d where µ is the attenuation coefficient
and d is the measured depth, i.e. the distance from the back to the centre of the kidney.
The relative loss of counts for a certain depth difference d1-d2 is
e − μ ⋅d1 − e − μ ⋅d 2
. Assuming
e − μ ⋅d1
equal attenuation coefficients on both sides a depth difference of only one centimetre will
result in 11% less number of counts from one side which gives the distribution 47%/53%
versus the true distribution 50%/50%. A depth difference of 2 cm will result in a deviation
of 21%, based on the assumption that µ= 0.1165 cm-1.
1.2. Conventional methods
One way to handle the deviation problem is to determine the depths of the kidneys using
ultrasound. The attenuation in the intermediate tissue is then compensated for by using a
correction factor, f correction = e μ ⋅d . The ultrasound method requires that the patient is in a
sitting position in which the kidneys often slide down resulting in another difference in
depths. One can then not guarantee that the location of the kidneys will not change even
more during the examination which makes the method unreliable. This method is not only
time-consuming but it also contains a certain measurement error.
The method used at the Karolinska Hospital in Solna intends to minimize the difference in
depth by letting the patient perform a gymnastic move prior to the exam. The patient lifts
the bottom from the bed a few times while lying on the bunk. This forces, in most cases,
the kidneys to fall back into their cavities and they will therefore be located at similar
depths. Sometimes though, this move does not help due to earlier surgery, inflammation
or kidney anomalies.
7
An alternative method is possible with the Hawk-Eye system. While it has an integrated
CT it is possible to determine the depth. However, this increases the radiation dose to the
patient and the question has to be addressed whether the advantage of the procedure
overcomes the risk associated with an increased radiation dose. This particular CT gives
such a low radiation dose so that the advantage overcomes the risk. However the extra
time required for performing the x-ray and making the calculations is a disadvantage. A
simpler method would be preferable.
1.3. Geometric mean method
The purpose of this work is both to minimise uncertainties and to simplify the procedure
in clinical examinations that require a comparison of activity content in different regions
of the body. The method is based on the creation of a geometric mean image from two
opposite images. One posterior and one anterior image set are fused together to form the
geometric mean image set. The initial idea was to apply the method on kidneys prior to
kidney transplants to determine which kidney to remove from the donator. It is important
to have relative values on the function and uptake of each kidney because the one with the
poorest function will be removed for donation.
The main difference between the old method and the new one, which is labelled the
geometric mean method, is that both camera heads are used during the acquisition. One
head is positioned, as before, beneath the patient while the other head is placed opposite to
the first head, i.e. in the front of the patient close to the abdomen. Both image sets are sent
to the evaluation station where they are processed by the developed program, called
Geo_Mean_Fusion. This program calculates the geometric mean values between each
pixel pair that corresponds to the same position in the image set. When this has been done
the resultant image set is saved and can then be opened at any evaluation station for
further analysis as previously described. When the comparison of the uptakes is performed
with the new method the result will, in most cases, be less inaccurate if there is a
difference in coronal positions of the kidneys. Why does then a geometric mean value
give a better comparison?
The geometric mean value answers the question: If both quantities had the same value,
what would that value have to be in order to achieve the same product? This is what we
8
want to know because it gives the same result independent of the coronal position of the
activity. Another way to describe it is that the geometric mean is independent of the depth.
Let us call the activity in the object A, the distance from the back to the centre of the
object d [cm], and the attenuation coefficient µ [cm-1]. The thickness of the body, i.e. the
distance from the surface of the back to the surface of the abdomen, is set to unity. The
attenuation factor will then be e − μ ⋅d in one direction and e − μ ⋅(1− d ) in the opposite direction.
The number of counts detected in each detector will therefore be proportional to
A ⋅ e − μ ⋅d and A ⋅ e − μ ⋅(1− d ) . The geometric mean of the number of counts is then proportional
to
G.M . = A ⋅ e − μ ⋅d ⋅ A ⋅ e − μ ⋅(1− d ) .
This expression can easily be simplified to
G.M . =
A
eμ
From this it is clear that the geometric mean has no dependence of the depth d. It would be
sufficient to just calculate the product of the corresponding pixel values, without
calculating the square root, while this also gives a depth independent value proportional to
the activity. However, I choose to calculate the geometric mean because I want the pixel
values to have the same order of magnitude as the original images. Observe that the
arithmetic mean,
A ⋅ e − μ ⋅d + A ⋅ e − μ ⋅(1− d )
,
A.M =
2
is not independent of depth and consequently can not be used for this purpose.
1.4. Related studies
Several studies have been done investigating the relevance in using the geometric mean
method. H. Benito I et al (2001), has investigated this with the age of the patient and the
diagnosis taken into account. The conclusion was that patients older than nine years and
patient with genitourinary malformations show a statistical significant difference between
the posterior and the geometric mean method. Similar conclusions were made by Yapar
AF et al (2005). A large investigation of the impact of gas in the intestines, on the
geometric mean method, seems not to have been done. This is briefly investigated in this
paper.
9
2. MATERIALS AND METHODS
2.1. Gamma camera
The gamma camera (Hawk-Eye, manufactured by GE) is a Single Photon Emission
Computed X-ray Tomograph, SPECT, with an integrated Computed Tomograph, CT,
which is called a SPECT-CT. It has two flexible heads which can be adjusted to most
desirable positions.
2.2. Evaluation station and programming environment
The code is written in the language Aladdin. Aladdin is a language developed by GE and
it is based on Basic Script which is similar to Visual Basic. Aladdin contains functions
that are convenient to use when dealing with images and series of images. For example it
is possible to create matrixes with pixel values from images and perform operations
directly on images by using predefined functions. The programming environment is
included in the Entegra package which is a full image evaluation system, also developed
by GE. Entegra includes several applications written in Aladdin, suitable for evaluation of
many different kinds of patient examinations. Due to the fact that Aladdin is a script
language, which implies that it doesn’t need to be compiled, it is not possible to run
applications without having the Entegra package installed on the computer. The term
script refers to a set of instructions (a program) that is executed by another program rather
than the computer’s processor. In our case the other program is Entegra.
It is obvious that Aladdin is constructed a bit sloppy. Some notations are not consistent
and bugs appear more often than in languages having had time to develop during several
years. Another problem, originating in the performance of the computer, is that errors
appear when big datasets are processed. When the computer can’t hold more data in the
memory the system gets instable and has to be restarted in stead of giving a warning,
which would be preferable. The method to get around this will be explained later on.
3. RESULTS
3.1. Properties of the program
The new program is named Geo_Mean_Fusion as it creates a fusion image from two
images by calculating the geometrical mean value for each pixel in the image. The
program is described in detail later on.
10
Normally each image in the series of images is acquired during 10 seconds. In the case of
a 40 minutes measurement we get 480 images in total for both heads. Each image has 128
x 128 pixels which end up in approximately four million calculations to create the
geometric mean images. Due to the relatively complicated operation N1 ⋅ N 2 , which is
the formula for the geometrical mean, quite some time is required to complete the set of
images. The square root is a time consuming operation for the computer while it requires
an iterative algorithm. Under some circumstances up to one minute can be necessary to
produce the whole set of images. An initial problem was that the computer, despite its one
gigabytes ram-memory, could not hold sufficiently much data to be stable throughout the
calculations. The algorithm is therefore designed to carry out a limited number of
operations before the results are saved on the hard drive.
The lack of flexibility is often a problem with applications constructed by big companies.
They often limit the possibilities for the user because they want to be sure that mistakes
should not be possible to make and to increase the need for future purchases.
Geo_Mean_Fusion was created with the intention to be very flexible. The reason for this
is that it is difficult to predict future needs of the application. A flexible application is
more likely to be useful for other purposes than what it is constructed for.
In the Department for Nuclear Medicine at the Karolinska Hospital, physicians often use
different evaluation stations to evaluate images. This is the reason why I have constructed
a separate application and thus have not integrated it in existing applications for renal
analysis. In Geo_Mean_Fusion you can either choose to watch the images directly in the
program or save them so that you can export them to whatever evaluation station you
prefer to use.
3.2. Program code in words
The program code can be viewed in appendix 1. To facilitate the understanding of the
code the program is in the following explained in words. Figure 1 visualizes the program
design. The ellipses with fat borders represent functions that will be executed by the user
while the other ellipses represent functions and sub functions executed by the program
itself. The arrows explain the flow between the routines.
11
Sub Geometrisk
Sub handleCB1 & 2
Fn DataValidate
Sub displayImage
Sub Main
Sub FelGeo
Sub SkapaScreen
Fn GeoMean
Sub ZoomaIn
Sub SaveGeoMean
Sub SaveAll
Sub ZoomaUt
Fn SaveAndExito
Sub Helpo
Sub displayImageAll
Figure 1. Flow scheme over Geo_Mean_Fusion. Ellipses with fat borders illustrate
functions which are executed directly by the user while ellipses with thin borders
illustrate functions executed by the program itself.
1. To be sure that the selected data set is appropriate to apply on Geo_Mean_Fusion the
set is checked by a data validation routine named “Function DataValidate” in the code.
This is by default the first code to be executed. The set must consist of two images or
image sets unless the third set is a result from earlier work with Geo_Mean_Fusion. If
the data set does not fit into the criteria warning texts will notify and specify the
problem for the user. If the user accepts the problem Geo_Mean_Fusion will start
despite the warnings. The reason for this is to maximize the flexibility of the system.
Of course this assumes that the user knows what he is doing. “DataValidate” also
loads the images so that they are accessible later on.
2. When the chosen study has been validated the script goes on to “Sub Main”. “Sub
Main” first clears the memory from eventual error messages and clipboard objects.
Then it redirects to the sub function “skapaScreen” where so called view ports are
created. A view port is an area where images and texts can be plotted. The images are
plotted in the view ports and the viewing direction is printed beneath the images and
checked to agree with the images header files. A toolbox for image viewing, which is
included in the Aladdin package, is put on the left side of the screen. This gives the
user the possibility to:
12
• Create Regions of Interest, ROIs.
• Run the frames as a movie.
• Reframe the series, i.e. pick out the most relevant frames for inspection.
• Make annotations and distance and angle measurements.
• Panorate and zoom the images.
• Adjust colours for improved visibility.
• Get statistical information about images or ROIs.
The tools for handling the image processing, i.e. create geometrical mean images,
are put on the left side of the screen. The user has the following possibilities:
• Create geometrical mean images
• Chose whether the created image should be viewed from behind or from the front.
Geo_Mean_Fusion is now standing by for further orders. Figure 2 shows the screen
when a geometric mean image and a ROI have been created.
Figure 2. Main window with ROI around the geometric mean image
13
3. If the user presses the button “Skapa geometrisk medelvärdesbild” the subroutine
“Geometrisk” starts. First a text that says that the procedure might take a while is
printed on the screen. Buttons for further operations are enabled and disabled to
prevent the user from making illegal operations. The choice of viewing angle is
controlled before the calculation starts. Due to limited memory space the number of
frames in the images is controlled. If the number of frames exceeds 100 a subroutine
called “FelGeo” is called. This routine divides the image sets into four equally large
image sets and sends them one by one to the subroutine “GeoMean” to be processed.
The program is prepared for additional image fusion routines why a variable called
“Aktuell” is filled with the string “Geometrisk” to be able to distinguish the created
image set from other image sets.
4. The actual calculations are made in the function “GeoMean”. This routine can be seen
as the heart of the program and is quite short. The process in “GeoMean” is explained
in a few steps below:
• The number of images in the sets are controlled.
• The pixel dimensions are controlled.
• The pixel values are read from the images and put in three dimensional matrixes.
• A double for loop runs and calculates the geometrical mean values for each pixel
and puts them into a three dimensional matrix. Before each operation the pixel
values are converted from integer to long which means that they use 4 bytes instead
of 2 bytes. If this is not done there is a big risk for errors to occur due to lack of bits
during the calculations. While each byte consist of 8 bits the maximum integer value
is ± 2 ( 2⋅8−1) = ±32768 . The reason for subtracting 1 in the exponent is that one bit is
needed to represent the sign of the value. When the multiplication of the pixel values
is carried out the product will often exceed 32768. In the case of 4 bytes the largest
value to be represented is ± 2 ( 4⋅8−1) ≈ ±2 ⋅ 10 9 , which is more than enough to
represent the products.
• When the matrix is created it only remains to create the geometrical mean image out
of the pixel values.
14
“GeoMean” is as a function which means that it demands input values and returns an
output value, i.e. an image. This approach facilitates the programming while it makes
it unnecessary to rewrite the code when you want to do the same calculations in some
other context.
5. The script now returns to “Geometrisk” where the recently created image is sent to the
sub function “displayImage” to be plotted in a separate view port.
6. The ellipses in the flow scheme with dashed borders represent further options
available to the user.
• “ZoomaUt” makes it possible for the user to view the geometrical mean image in
full screen which makes it easier to draw ROIs and evaluate the image for a correct
diagnosis of the patient.
• “ZoomaIn” simply returns to the default view where all images are viewed.
• “SaveGeoMean” saves the image.
• “SaveAll” saves the image including eventual ROIs and notations.
• “SaveAndExito” Saves the image, ROIs and notations and terminates the program.
• “Helpo” opens a help file where the user can read an explanation of the program.
3.3. Phantom measurements
Geo_Mean_Fusion has been tested on images originating from phantom measurements.
The phantom was a water filled PMMA container shaped like the abdomen region where
the kidneys are located. The kidney phantom was a plastic container with size and shape
like a real kidney. Both kidneys were represented by the same phantom to guarantee that
the activity content was the same. Acquisitions were made with the kidney phantom at
different depths in the body and decay corrections were made for each acquisition to allow
the simulation of two kidneys with only one phantom. The kidney phantom was filled
with approximately 50 MBq
99m
Tc which is slightly more activity than is normally
accumulated in one kidney. The reason for this was to get better statistics. Data
acquisitions were made during 3 minutes with the kidney phantom at different depths. The
result is presented in Figure 3.
15
1.2
normalized number of counts
1.0
0.8
posterior head
geometric mean
attenuation correction
0.6
anterior head
fit
0.4
y = 1.3635e-0.0141x
0.2
0.0
20
40
60
80
100
120
140
distance phantom surface-centre of kidney phantom [mm]
Figure 3. Comparison between methods with kidney phantom. The measurements were made
using a water phantom in which a 99mTc source were moved in 10 mm steps from one side to the
other.
The correction factor f, used to create the attenuation corrected curve, is given by
f = e μ ⋅d where µ is the linear attenuation coefficient and d is the depth of the kidney. The
depth is defined as the distance from the phantom surface to the surface of the kidney
phantom. The attenuation coefficient is effective which means that scattering is
compensated for in the coefficient. The value of µ is acquired from the exponential fit in
Figure 3. The increase in count rate of about 4% in the centre of the phantom, is due to a
larger fraction of scattered radiation. This is though not a problem because the kidneys are
located on similar depths and therefore undergo the same effect on both sides. The
distribution of activity between the kidneys will therefore not be much effected.
The human body is far from symmetric with respect to attenuation coefficients. The
kidneys are more or less shadowed by the liver and intestines. The liver has a higher
attenuation coefficient than intraperitoneal adipose tissue from which follows that the
radiation will be more attenuated on the liver side. Intestines are often more present at the
left side. A worst case scenario, which is not probable in reality, was simulated using a
phantom. The effects of different attenuation coefficients in gas, adipose tissue and water
are illustrated in Figure 4. The values originate from phantom measurements. The air
16
cavity was 4.5 cm thick and covered approximately 80 % of the kidney while the adipose
was 5 cm thick and covered the whole kidney.
140000
post
post
120000
post
# counts
100000
80000
geo
geo
geo
60000
ant
40000
ant
ant
20000
0
water only
water + 5 cm fat
water + 5 cm fat + 4.5 cm gas
Figure 4. Effects on the number of detected counts with different materials
in front of the kidney. The effects on the geometric mean values are also
visualized.
A large difference in the amount of adipose tissue does not affect the result more than
approximately 2% which gives a side difference 50.5%/49.5% in stead of the true
50%/50%. However, gas in the intestines affect the value of the activity distribution much
more. The darkest piles in Figure 4 illustrate this effect. The side distribution of activity is
calculated according to:
D=
left
right
⋅ 100%
⋅ 100%
(left + right )
(left + right )
where left and right are the number of counts detected on respectively side. If the
calculation is done with the geometric mean values for the measurement with fat and air
present the value D = 55.1%/44.9%. In this case the geometric mean method gives a
misleading result.
3.4. Simulations
To find out about the usefulness of the geometric mean method on real patients,
simulations based on 37 CT images were carried out. By inspection of the CT images it
17
was found that 4.5 cm of homogenous gas distribution, as used in the phantom
measurement, is highly unlikely to appear. Figure 5 shows an example of a CT image
where a large air cavity is present. However, the cavity only covers a small part of the
kidney. The other slices thus do not show this big air cavity.
Figure 5. CT image where air cavity is visible
Every slice, which contained a part of any kidney, was investigated with respect to
distance from the surface of the kidney to the front and the back of the patient. The slices
represented 5.0 mm each. Mean attenuation values were achieved from five patients by
drawing ROIs over the intermediate tissue. Supposed that each kidney had the same
activity content the activity distributions were calculated simulating the use of only a
posterior head as well as the use of both a posterior and an anterior head to form
geometric mean images. Figure 6 shows the obtained activity distributions for the five
patients. In four cases the geometric mean method gave a better result than the posterior
method. In Figure 6 four simulated patients are included to clarify the impact of depth
differences and attenuation differences. The data are listed in Table 1.
2
18
Fa
Fa
ke
4
ke
55
ke
Fa
t ie
1
Pa
53
Fa
ke
52
51
posterior
50
geo mean
49
nt
t ie
t ie
nt
1
46
Pa
t ie
Pa
47
5
nt
t ie
4
nt
2
48
Pa
% appearing to originate in right kidney
nt
3
3
54
Pa
45
Figure 6. Simulation of clinical examinations using CT-images. Each pile
pair represents a patient. Red piles represent the posterior method and
green piles represent the geometric mean method. The Y-axis represents
the proportion of the total number of counts appearing to originate from
the right kidney. In case of a true representation the piles should be at 50
%, i.e. not visible.
DISTRIBUTION [%]
POSTERIOR
DISTANCE DIFFERENCE [CM] ATTENUATION DIFFERENCE [%]
GEOMETRIC
ANTERIOR
POSTERIOR
ANTERIOR
POSTERIOR
51.33 48.67
-0.33
50.20 49.80
1.43
-0.96
6.27
-0.40
-0.47
-10.92
50.13
47.16 52.84
1.10
1.31
0.00
-0.94
52.29
47.71
0.64
48.37 51.63
0.99
-0.45
2.26
-0.65
Patient 5, male
52.80
Fake 1
50.01
47.20
52.37 47.63
-0.70
-0.55
2.28
-0.99
49.99
47.84 52.16
1.00
0.00
-0.39
Fake 2
0.00
45.25
54.75
47.71 52.29
0.00
1.00
-0.39
0.00
Fake 3
50.01
49.99
45.49 54.51
0.00
0.00
20.00
0.00
Fake 4
46.19
53.81
48.18 51.82
0.00
0.00
-0.39
20.00
dx
sin
Patient 1, male
54.46
45.54
Patient 2, female
52.00
48.00
Patient 3, mail
49.87
Patient 4, female
dx
sin
Table 1. Effect on values of activity distribution for different attenuation values and distances
from kidney surfaces to abdomen and back. Five real patients and four simulated patients are
listed. The simulated patients clarify the impact of the variables.
A difference in posterior distance has greater impact on the geometric mean value than a
difference in the anterior distance because the attenuation factor in general is lower on the
anterior side. Patient number 3, where the posterior method is better, has a posterior depth
difference close to zero which causes the posterior method to give a perfect result. The
anterior distance is large which causes the geometric mean method to fail in its prediction.
The CT images are acquired with mean photon energy 73 keV. The simulations therefore
depend on a similar relation between the attenuation in the tissues for 140.5 keV which is
the emission energy from
99m
Tc, and for 73 keV. If the side distribution is 57.7%/42.3%
19
for a two centimetre air cavity calculated with the attenuation factors for 140.5 keV, the
corresponding value calculated with the attenuation factors for 73 keV is 59.5%/40.5%.
The simulations thus give larger errors than actual examination would give.
The effects on the number of detected counts from a homogenous air cavity and adipose
tissue with different thicknesses are illustrated in Figure 7. The graph comes from
theoretical modelling of a 20 cm thick body. The attenuation values are taken from the
web site http://physics.nist.gov/PhysRefData/XrayMassCoef/cover.html, which is a
collection of values brought from the photon interaction database at the National Institute
of Standards and Technology.
1,4
1,35
relative number of counts
1,3
1,25
air cavity
1,2
adipose tissue
1,15
1,1
1,05
1
0
1
2
3
4
5
distance [cm]
Figure 7. Effect of air cavity and adipose tissue.
To get an idea of how many examinations that will gain accuracy by using the geometric
mean method the 37 adult patients were examined re difference in posterior kidney depth.
The mean depth difference was 0.64 cm and one standard deviation was 0.54 cm. From
this follows that 4.5 % of the patients are expected to have a posterior depth difference
larger than 1.18 cm. This difference causes the measured distribution to appear to be
around 46.6%/53.4% in stead of an actual distribution of 50%/50% if only a posterior
head is used. This error can result in donation of the kidney with best function in stead of,
as desired, the one with poorest function. The geometric mean method does not alone
solve the problem because there is a possibility, in case of large air cavities, that another
error will be added to the first one. In the discussion at the end of this paper a method for
determination of the accuracy of the geometric mean method is presented. With this
method it is possible to determine if the result is reliable or not.
20
3.5. Clinical examinations
It is not an easy task to determine the actual activity distribution in patients. This study
relies completely on phantom measurements. With the results from these measurements as
an indication for accurate results the method is now used as additional information in
determination of kidney function prior to transplant surgery. A clinical example can be
viewed in Appendix 2.
4. DISCUSSION
4.1. Disadvantages
In case of kidneys at the same depth the geometric mean method will deteriorate the result
because the attenuations very likely differ between the left and the right side. By
implementing the method for determination of accuracy presented below it is probably
possible to determine whether the result is deteriorated or improved.
In case of examination of children there might be a risk of complications due to partial
volume effects. This has not been further investigated while the work concentrates on the
determination of the relative kidney function. Because the partial volume effect will be of
the same magnitude over both kidneys the result will not be affected.
4.2. Possible areas of use
When a comparison of the uptake of a tracer at different depths in the body is needed,
Geo_Mean_Fusion might be helpful. It often gives an improved comparison of activities
within ROIs, compared to methods using only one camera head.
Currently a project dealing with malaria is going on at the department. This research is
dependent on an accurate comparison of activity in different parts of the body. It has
shown that the results are different with the geometric mean method.
Sometimes it is desirable to compare the arterial flow in the lungs. This can be indicated if
using a radiopharmaceutical which accumulates proportional to the flow in the arteries.
For these kinds of examinations the geometric mean method is probably an advantage
while the body is reasonably similar on both sides in the lung region.
21
4.3. Method for determination of accuracy
A method for determination of activity distribution is here explained in a number of steps.
The method has yet not been tested on patients or phantoms.
I. Create a geometric mean image.
II. Select some frames in the image with high activity content and add them together.
This can be done in Entegra by using the summation button in the toolbox.
III. Draw ROIs over the kidneys in the geometric mean image.
IV. Copy that ROI to the posterior and the anterior images.
V. Note the number of counts in each ROI.
VI. If the number of counts in the left kidney is called Nsin and the number of counts in
the right kidney is called Ndx calculate D for the posterior and the anterior images
according to:
Di =
N sin − N dx
N sin + N dx
VII. If D post ≈ − Dant the geometric mean image can be used for evaluation with a
guaranteed accurate result.
VIII. If D post ≠ − Dant an air cavity is present, the body is asymmetric or both. The
geometric mean image can not be used for evaluation. In this case it is relevant to
make a CT-image of the patient to determine the kidney depths and make a manual
attenuation correction as described in section 1.2. The criteria for when the
inequality can be considered fulfilled has to be experimentally investigated. This
has yet not been done.
The D value is a measure of the activity distribution related to the number of counts from
both kidneys. It allows a comparison between the distribution measured with the posterior
and the anterior camera head. If the values are similar with opposite signs the tissues
around the kidneys must be symmetric which means that the geometric mean images give
accurate values on the activity distribution. Acceptable values on Dpost - Dant have yet not
been investigated but the intention is to proceed with this work later on.
22
4.4. Absolute activity
A natural continuation of this work is to implement a model for determination of the
absolute activity content in a region. A method is described by Fleming et al. 1979. The
advantage using the Hawk-Eye camera is that an attenuation map can be achieved by the
CT which would make it possible to determine the activity with good accuracy. An
algorithm which guides the user and makes the required calculations can be developed in
Aladdin. Perhaps it is possible to determine the kidney depths by performing two scout
views from different angles and make a simple attenuation correction.
5. CONCLUSION
The geometric mean method does not guarantee an improved result compared to the
traditional posterior method. However if it is used together with the method for accuracy
determination, which is yet not experimentally verified, it should be possible to obtain a
value of the accuracy. This value can serve as the basis for the decision whether the
kidney depths has to be determined with a CT or some other method, to be able to make a
manual attenuation correction.
23
REFERENCES
•
Larsson Stig A.: Gamma Camera Emission Tomography, Acta Radiologica,
supplementum 363, 1980
•
Granerus Göran: Njurarna och övre urinvägarna, Studentlitteratur, 1999
•
Starck S-Å, Carlsson S, The determination of the effective attenuation coefficient from
effective organ depth and modulation transfer function in gamma camera imaging,
Phys. Med. Biol. 42, 1997
•
Fleming J.S.: A Technique for the absolute Measurement of Activity using a Gamma
Camera and Computer, Phys. Med. Biol., Vol. 24, 1979
•
Norrgren Kristina et al., Accuracy of the Quantification of Organ Activity from Planar
Gamma Camera Images, Cancer Biotherapy & Radiopharmaceuticals vol. 18, 2003
•
Hervas Benito I et al: Value of the use of the geometric mean to calculate the relative
renal function in 99mTc-DMSA renal scintigraphy, Revista Espanola de Medicina
Nuclear, 2001 Dec;20(7):517-24
•
Lythgoe MF et al: Estimation and relevance of depth correction in paediatric renal
studie, European Journal of Nuclear Medicine, 1998 Feb;25(2):115-9.
•
Buijs WC et al: Absolute organ activity estimated by five different methods of
background correction, Journal of Nuclear Medicine, 1998 Dec;39(12):2167-72.
•
Porn U et al: Calculation of the partial function of the kidney with DMSA in
pediatrics: is the evaluation of the geometric mean necessary?, Nuklearmedizin, 2001
Aug;40(4):107-10.
•
Yapar AF et al: The conditions for which the geometric mean method revealed a more
accurate calculation of relative renal function in 99mTc-DMSA scintigraphy, Nuclear
Medicine Communications, 2005 Feb;26(2):141-6.
24
ABSTRACT
When a comparison of the activity content in pair organs is carried out one must take into
account the attenuation in the intermediate tissues. A method for doing this is to acquire
images with two camera heads, opposite to each other, and calculate the geometric mean
values for each corresponding pixel pairs to form a new image. This image can be used for
determination of activity distribution. The method has been implemented by developing a
computer program. The program is developed in Aladdin. Aladdin is a script language
included in the evaluation environment Entegra which is developed by General Electrics.
Phantom measurements and theoretical modelling has been made to verify the usefulness
of the method. It was found that an improved basis for diagnosis is achieved in most
cases. A possible method for determination of the accuracy of the method for each single
case is presented.
25
APPENDIX 1
PROGRAM CODE FOR GEO_MEAN_FUSION
Dim MaxImages As Integer
Dim ImageItems() As Image
Dim MaxCurves As Integer
Dim CurveItems() As Curve
Dim mainScreen As Screen
Dim mainScreen0 As Screen
' Number of images selected by user
' Array of images selected by user
' Number of curves selected by user
' Array of curves selected by user
'---------deklarationer--------------------------------------------------------------------------------------------Type Results
GeoMeanImage
As Image
AritMeanImage
As Image
End Type
Dim vp
Dim vp0
Dim vp1
Dim vp2
Dim vp3
Dim i
Dim j
Dim k
Dim l
Dim xsize
Dim ysize
Dim langd
Dim langd1
Dim pixelvalues0()
As Integer
Dim pixelvalues1()
As Integer
Dim postVal
Dim antVal
Dim GeoMeanImage
Dim AritMeanImage
Dim OwnImage
Dim GeoImg
Dim AritImg
Dim newImage
Dim img1
Dim img2
Dim FusImage1
Dim FusImage2
Dim del1
Dim del2
Dim vpName
Dim formula
Dim VinkelKollGeo
Dim VinkelKollArit
As String
Dim Aktuell
Dim knapp1
Dim knapp2
Dim knapp3
Dim geoMeanExist As Boolean
Dim aritMeanExist
Dim ZoomIn
Dim conArea
Dim textAnnot
Dim ProcResults
'Dim zoomScreen
As viewport
As viewport
As viewport
As viewport
As viewport
As Integer
As Integer
As Integer
As Integer
As Integer
As Integer
As Integer
As Integer
As Integer
As Integer
As image
As image
As image
As image
As image
As image
As image
As image
As image
As image
As image
As image
As String
As String
As String
As String
As Boolean
As Boolean
As Boolean
As Boolean
As Boolean
As ControlArea
As annot
As Results
As Screen
Declare Sub Geometrisk()
Declare Sub Fel()
Declare Sub displayImage (img As image)
Declare Sub handleCB1()
Declare Sub handleCB3()
Declare Sub zoomaIn()
Declare Function GeoMean(img1 As image, img2 As image) As image
Declare Function AritMean(img1 As image, img2 As image) As image
'Declare Function SaveAndExito() As Integer
'------------------------------------------------------------------------------------------------------------------'---------huvudprogram---------------------------------------------------------------------------------------------'------------------------------------------------------------------------------------------------------------------Sub Main
Clipboard.Clear
Err.Clear
geoMeanExist = false
skapaScreen
CardStatusDisplay ""
DisableButton 2, 1
DisableButton 2, 2
DisableButton 1, 2
DisableButton 1, 3
knapp1 = FALSE
knapp2 = FALSE
knapp3 = FALSE
End Sub
'-------------------------------------------------------------------------------------------------------------------
26
Function DataValidate(dv_Message
As String,_
sel_image_list() As Image,_
numImages
As Integer,_
sel_curve_list() As Curve,_
numCurves
As Integer) As Integer
Dim item
As Integer
Dim dbVal As Variant
maxImages = 0
maxCurves = 0
' Collect the images
For item = 0 To numImages-1
MaxImages = MaxImages + 1
ReDim Preserve ImageItems(MaxImages)
Set ImageItems(item) = sel_image_list(item)
Next item
If numImages < 2 Then
MsgBox "Detta dataset innehåller mindre än två bilder. Programmet kommer därför inte att kunna beräkna medelvärdesbilder."
End
End If
Dim retVal1
Dim Val1
As Integer
Dim retVal2
As Integer
As Variant
Dim Val2 As Variant
retVal1 = GetAttribValue(ImageItems(0), "Dataset", "DatasetName", Val1)
retVal2 = GetAttribValue(ImageItems(1), "Dataset", "DatasetName", Val2)
If Val1 <> "ANT" Then
MsgBox "Bild 1 i listan har inte namnet 'ANT', Var uppmärksam så att du inte förväxlar bilderna"
End If
If Val2 <> "POST" Then
MsgBox "Bild 2 i listan har inte namnet 'POST', Var uppmärksam så att du inte förväxlar bilderna"
End If
If numImages > 2 Then
MsgBox "Detta dataset innehåller mer än två bilder. Den första förutsätts vara 'ANTERIOR' och den andra 'POSTERIOR'."
End If
dv_Message = "Validation Successful"
DataValidate = 1
End Function
'---------Beräkna geometriskt medelvärde---------------------------------------------------------------------------Function GeoMean(img1 As image, img2 As image) As image
'On Error GoTo Catch
langd = img1.Length
GetPixelData img1,1,-1,pixelvalues0,xsize,ysize
GetPixelData img2,1,-1,pixelvalues1
'här blir det run time error för bilder med många frames
Dim fuspixelvalues(0 To langd-1, 0 To ysize-1, 0 To xsize-1) As Integer
For j = 0 To langd-1
For k = 0 To ysize-1
For l = 0 To xsize-1
fuspixelvalues(j,k,l) = sqr(CLng(pixelvalues0(j,k,l))*CLng(pixelvalues1(j,k,xsize-1-l)))
Next l
Next k
Next j
Set GeoMean = ImportImgset(ImageItems(0), fuspixelvalues, xsize, ysize, langd)
Exit Function
'Catch:
'FelGeo
End
End Function
'-------------------------------------------------------------------------------------------------------------------/*
Sub SaveGeoMean()
Dim retIndex As Integer
Dim index As Variant
Dim albert As image
If VinkelKollGeo = "PostVal" Then
Set albert = GeoImg
retIndex = SetAttribValue(albert, "SeriesType", 6, index)
Set ProcResults.GeoMeanImage = Copy(albert, "POST Geometrisk Medelvärdesbild")
clear albert
ElseIf VinkelKollGeo = "AntVal" Then
Set albert = GeoImg
retIndex = SetAttribValue(albert, "SeriesType", 6, index)
Set ProcResults.GeoMeanImage = Copy(albert, "ANT Geometrisk Medelvärdesbild")
clear albert
End If
SaveResults ProcResults
disableButton 2,1
disableButton 2,3
'GeoSpar = True
End Sub
*/
'-------------------------------------------------------------------------------------------------------------------Sub SaveGeoMean()
Dim retIndex As Integer
Dim index As Variant
If VinkelKollGeo = "PostVal" Then
Set ProcResults.GeoMeanImage = Copy(GeoImg, "dynamic kidney")
ElseIf VinkelKollGeo = "AntVal" Then
Set ProcResults.GeoMeanImage = Copy(GeoImg, "ANT Geometrisk Medelvärdesbild")
End If
'retIndex = SetAttribValue(ProcResults.GeoMeanImage, "SeriesType", 6, index)
SaveResults ProcResults, "Geo_Mean_Fusion"
disableButton 2,1
disableButton 2,3
'GeoSpar = True
End Sub
27
'-------------------------------------------------------------------------------------------------------------------Sub SaveAll()
If geoMeanExist = TRUE Or aritMeanExist = TRUE Then
If VinkelKollGeo = "PostVal" Then
Set ProcResults.GeoMeanImage = Copy(GeoImg, "POST Geometrisk Medelvärdesbild")
ElseIf VinkelKollGeo = "AntVal" Then
Set ProcResults.GeoMeanImage = Copy(GeoImg, "ANT Geometrisk Medelvärdesbild")
End If
If VinkelKollArit = "PostVal" Then
Set ProcResults.AritMeanImage = Copy(AritImg, "POST Aritmetrisk Medelvärdesbild")
ElseIf VinkelKollArit = "AntVal" Then
Set ProcResults.AritMeanImage = Copy(AritImg, "ANT Aritmetrisk Medelvärdesbild")
End If
SaveResults ProcResults, "Geo_Mean_Fusion"
disableButton 2,1
disableButton 2,2
disableButton 2,3
Else
MsgBox "Det finns inga resultat att spara"
End If
End Sub
'-------------------------------------------------------------------------------------------------------------------Function SaveAndExito() As Integer
'MsgBox "Save And Exit"
If geoMeanExist = TRUE Then
If VinkelKollGeo = "PostVal" Then
Set ProcResults.GeoMeanImage = Copy(GeoImg, "POST Geometrisk Medelvärdesbild")
ElseIf VinkelKollGeo = "AntVal" Then
Set ProcResults.GeoMeanImage = Copy(GeoImg, "ANT Geometrisk Medelvärdesbild")
End If
SaveResults ProcResults, "Geo_Mean_Fusion"
End If
If aritMeanExist = TRUE Then
If VinkelKollArit = "PostVal" Then
Set ProcResults.AritMeanImage = Copy(AritImg, "POST Aritmetrisk Medelvärdesbild")
ElseIf VinkelKollArit = "AntVal" Then
Set ProcResults.AritMeanImage = Copy(AritImg, "ANT Aritmetrisk Medelvärdesbild")
End If
SaveResults ProcResults, "Geo_Mean_Fusion"
End If
SaveAndExit = TRUE
'Exit
End Function
'-------------------------------------------------------------------------------------------------------------------Sub Helpo()
Dim MyObject As Object
Set MyObject = GetObject("c:\test.txt")
MyObject.Open
'MsgBox "Helpo"
'id = Shell("notepad.exe",1)
'Open "c:test.txt" For Output Shared As id
'SendKeys "C:test.txt{ENTER}",True
'AppActivate "Program Manager"
'Dim doc As Object
'Set doc = GetObject("C:\test.txt")
'This first example instantiates the existing copy of Excel.
'Dim notepad As Object
'Set notepad = GetObject(,"notepad.Application")
'This second example loads the OLE server associated with a
'document.
'Dim MyObject As Object
'Set MyObject = GetObject("c:\documents\resume.doc")
End Sub
'-------------------------------------------------------------------------------------------------------------------Function ConfirmQuit() As Integer
If geoMeanExist = TRUE Or aritMeanExist = TRUE Then
r% = AnswerBox("Vill du spara de skapade bilderna?", "JA", "NEJ", "AVBRYT")
Select Case r%
Case 1
SaveAll
ConfirmQuit = TRUE
Case 2
ConfirmQuit = TRUE
Case Else
ConfirmQuit = FALSE
End Select
Else
ConfirmQuit = TRUE
End If
End Function
/*
Function ConfirmQuit As Integer
If Quit = True Then
ConfirmQuit = True
Else
ConfirmQuit = False
End If
End Function
*/
'-------------------------------------------------------------------------------------------------------------------Sub Geometrisk()
28
Msg.Open "Var god vänta medan bilden skapas. Detta kan ta upp emot en minut beroende på bildens storlek.",0,False,False
CardStatusDisplay "Bild skapas..."
'sleep 1000
geoMeanExist = TRUE
EnableButton 1, 3
DisableButton 1, 1
EnableButton 2,1
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", antVal
If postVal = 1 Then
If ImageItems(0).length > 100 Then
FelGeo
VinkelKollGeo = "PostVal"
Aktuell = "Geometrisk"
displayImage GeoImg
ElseIf imageItems(0).length <= 100 Then
Set GeoImg = GeoMean (ImageItems(1), ImageItems(0))
VinkelKollGeo = "PostVal"
Aktuell = "Geometrisk"
displayImage GeoImg
End If
End If
If antVal = 1 Then
If ImageItems(0).length > 100 Then
FelGeo
VinkelKollGeo = "AntVal"
Aktuell = "Geometrisk"
displayImage GeoImg
ElseIf imageItems(0).length <= 100 Then
Set GeoImg = GeoMean (ImageItems(0), ImageItems(1))
VinkelKollGeo = "AntVal"
Aktuell = "Geometrisk"
displayImage GeoImg
End If
End If
Msg.Close
CardStatusDisplay ""
enableButton 2,1
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub FelGeo()
langd1 = ImageItems(0).length
If antVal = 1 Then
Set img1 = Extract(ImageItems(0), 1, langd1/4)
Set img2 = Extract(ImageItems(1), 1, langd1/4)
Set FusImage1 = GeoMean (img1, img2)
Set img1 = Extract(ImageItems(0), langd1/4+1, langd1/2)
Set img2 = Extract(ImageItems(1), langd1/4+1, langd1/2)
Set FusImage2 = GeoMean (img1, img2)
Set del1 = AppendImage(FusImage1, FusImage2)
Set img1 = Extract(ImageItems(0), langd1/2+1, langd1/2+langd1/4)
Set img2 = Extract(ImageItems(1), langd1/2+1, langd1/2+langd1/4)
Set FusImage1 = GeoMean (img1, img2)
Set img1 = Extract(ImageItems(0), langd1/2+langd1/4+1, langd1)
Set img2 = Extract(ImageItems(1), langd1/2+langd1/4+1, langd1)
Set FusImage2 = GeoMean (img1, img2)
Clear img1
Clear img2
Set del2 = AppendImage(FusImage1, FusImage2)
clear FusImage1
clear FusImage2
Set GeoImg = AppendImage(del1, del2)
clear del1
clear del2
'displayImageAll GeoImg
End If
If postVal = 1 Then
Set img1 = Extract(ImageItems(1), 1, langd1/4)
Set img2 = Extract(ImageItems(0), 1, langd1/4)
Set FusImage1 = GeoMean (img1, img2)
Set img1 = Extract(ImageItems(1), langd1/4+1, langd1/2)
Set img2 = Extract(ImageItems(0), langd1/4+1, langd1/2)
Set FusImage2 = GeoMean (img1, img2)
Set del1 = AppendImage(FusImage1, FusImage2)
Set img1 = Extract(ImageItems(1), langd1/2+1, langd1/2+langd1/4)
Set img2 = Extract(ImageItems(0), langd1/2+1, langd1/2+langd1/4)
Set FusImage1 = GeoMean (img1, img2)
Set img1 = Extract(ImageItems(1), langd1/2+langd1/4+1, langd1)
Set img2 = Extract(ImageItems(0), langd1/2+langd1/4+1, langd1)
Set FusImage2 = GeoMean (img1, img2)
Clear img1
Clear img2
Set del2 = AppendImage(FusImage1, FusImage2)
clear FusImage1
clear FusImage2
Set GeoImg = AppendImage(del1, del2)
clear del1
clear del2
'displayImageAll GeoImg
End If
CardStatusDisplay ""
'Err.Clear
'Exit Sub
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub hjalp
End Sub
'--------------------------------------------------------------------------------------------------------------------
29
Sub displayImage (img As Image)
'Viewport.Clear
If ZoomIn = TRUE Then
zoomaUt
ZoomIn = FALSE
End If
If geoMeanExist = TRUE And Aktuell = "Geometrisk" Then
Set vp2 = GetViewport("cell2")
vp2.LabelFormat = NUMBER_ONLY_FORMAT
Display img, "cell2"
'If postVal = 1 Then
If VinkelKollGeo = "PostVal" Then
Set textAnnot = AnnotText(vp2, 0.1, 1.0, "POST, Geometriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.01, 0.5, "sin")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.96, 0.5, "dx")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp2, 1, 0, 1, 1)
End If
'If antVal = 1
Then
If VinkelKollGeo = "AntVal" Then
Set textAnnot = AnnotText(vp2, 0.1, 1.0, "ANT, Geometriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.01, 0.5, "dx")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.96, 0.5, "sin")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp2, 1, 0, 1, 1)
End If
EnableButton 2, 1
knapp1 = TRUE
If knapp2 = TRUE Then
EnableButton 2, 3
End If
End If
If aritMeanExist = TRUE And Aktuell = "Aritmetrisk" Then
Set vp3 = GetViewport("cell3")
vp3.LabelFormat = NUMBER_ONLY_FORMAT
Display img, "cell3"
'If postVal = 1 Then
If VinkelKollArit = "PostVal" Then
Set textAnnot = AnnotText(vp3, 0.1, 1.0, "POST, Aritmetriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.03, 0.5, "sin")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.96, 0.5, "dx")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp3, 0, 0, 0, 1)
End If
'If antVal = 1
Then
If VinkelKollArit = "AntVal" Then
Set textAnnot = AnnotText(vp3, 0.1, 1.0, "ANT, Aritmetriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.03, 0.5, "dx")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.96, 0.5, "sin")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp3, 0, 0, 0, 1)
End If
EnableButton 2, 2
knapp2 = TRUE
If knapp1 = TRUE Then
EnableButton 2, 3
End If
End If
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub displayImageAll (img As Image)
Viewport.Clear
If geoMeanExist = TRUE Then
Set vp2 = GetViewport("cell2")
vp2.LabelFormat = NUMBER_ONLY_FORMAT
Display GeoImg, "cell2"
If VinkelKollGeo = "PostVal" Then
Set textAnnot = AnnotText(vp2, 0.1, 1.0, "POST, Geometriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.01, 0.5, "sin")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.96, 0.5, "dx")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp2, 1, 0, 1, 1)
End If
If VinkelKollGeo = "AntVal" Then
Set textAnnot = AnnotText(vp2, 0.1, 1.0, "ANT, Geometriskt medelvärde")
textAnnot.Font="helvb12"
30
Set textAnnot = AnnotText(vp2, 0.01, 0.5, "dx")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp2, 0.96, 0.5, "sin")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp2, 1, 0, 1, 1)
End If
End If
EnableButton 2, 1
knapp1 = TRUE
If knapp2 = TRUE Then
EnableButton 2, 3
End If
If aritMeanExist = TRUE Then
Set vp3 = GetViewport("cell3")
vp3.LabelFormat = NUMBER_ONLY_FORMAT
Display AritImg, "cell3"
'If postVal = 1 Then
If VinkelKollArit = "PostVal" Then
Set textAnnot = AnnotText(vp3, 0.1, 1.0, "POST, Aritmetriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.03, 0.5, "sin")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.96, 0.5, "dx")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp3, 0, 0, 0, 1)
End If
'If antVal = 1
Then
If VinkelKollArit = "AntVal" Then
Set textAnnot = AnnotText(vp3, 0.1, 1.0, "ANT, Aritmetriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.01, 0.5, "dx")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp3, 0.96, 0.5, "sin")
textAnnot.Font="helvb12"
Set lineAnnot = AnnotLine(vp3, 0, 0, 0, 1)
End If
End If
EnableButton 2, 2
knapp2 = TRUE
If knapp1 = TRUE Then
EnableButton 2, 3
End If
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub deleteImage()
MsgBox ("hopp")
Set vp = GetSelectedViewport()
vp.Clear
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub zoomaIn()
EnableButton 1, 4
Set mainScreen0 = CreateScreen("GeoMean0.rt", 1)
Set vp = GetViewport("mainScreen0")
Set vp0 = GetViewport("cell0")
vp0.LabelFormat = NUMBER_ONLY_FORMAT
status = SelectTools(TRUE, CINE_TOOL, REFRAME_TOOL, ANNOT_TOOL, PANZOOM_TOOL,COLORMAP_TOOL,STATS_TOOL,ROI_TOOL)
display GeoImg, "cell0"
ZoomIn = TRUE
/*
Viewport.Clear
Set vp2 = GetViewport("cell2")
vp2.LabelFormat = NUMBER_ONLY_FORMAT
Display img, "cell2"
*/
If postVal = 1 Then
Set textAnnot = AnnotText(vp0, 0.1, 1.0, "POST, Geometriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp0, 0.01, 0.5, "sin")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp0, 0.96, 0.5, "dx")
textAnnot.Font="helvb12"
End If
If antVal = 1
Then
Set textAnnot = AnnotText(vp0, 0.1, 1.0, "ANT, Geometriskt medelvärde")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp0, 0.01, 0.5, "dx")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp0, 0.96, 0.5, "sin")
textAnnot.Font="helvb12"
End If
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub zoomaUt()
EnableButton 1, 3
DisableButton 1, 4
skapaScreen
If geoMeanExist = TRUE Then
displayImageAll GeoImg
31
End If
If aritMeanExist = TRUE Then
displayImageAll AritImg
End If
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub skapaScreen()
Set mainScreen = CreateScreen("GeoMean.rt", 1)
Set vp = GetViewport("mainScreen")
Load ImageItems(1)
Load ImageItems(0)
Set vp0 = GetViewport("cell0")
vp0.LabelFormat = IDENTIFICATION_FORMAT
Display ImageItems(0), "cell0"
Set textAnnot = AnnotText(vp0, 0.1, 1.0, "ANT")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp0, 0.01, 0.5, "dx")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp0, 0.96, 0.5, "sin")
textAnnot.Font="helvb12"
Set vp1 = GetViewport("cell1")
vp1.LabelFormat = NUMBER_ONLY_FORMAT
Display ImageItems(1), "cell1"
Set textAnnot = AnnotText(vp1, 0.1, 1.0, "POST")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp1, 0.03, 0.5, "sin")
textAnnot.Font="helvb12"
Set textAnnot = AnnotText(vp1, 0.96, 0.5, "dx")
textAnnot.Font="helvb12"
status = SelectTools(TRUE, CINE_TOOL, REFRAME_TOOL, ANNOT_TOOL, PANZOOM_TOOL,COLORMAP_TOOL,STATS_TOOL,ROI_TOOL)
Set conArea = CreateControlArea (2)
'SetControlValue conArea, CA_LABEL,"hopp" , "hej hej"
AddControl conArea, CA_LABEL, "Välj från vilket håll du önskar se den skapade bilden!", "handleCB1", 10, 10, 230, 34
AddControl conArea, CA_CHECKBOX, "POSTERIOR", "handleCB1", 10, 44, 230, 34
AddControl conArea, CA_CHECKBOX, "ANTERIOR", "handleCB2", 10, 74, 230, 34
'AddControl conArea, CA_BUTTON, "VÄLJ", "handleCB3", 10, 124, 230, 34
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", TRUE
display conArea
Set vp2 = GetViewport("cell2")
Set lineAnnot = AnnotLine(vp0, 0, 1, 1, 1)
Set lineAnnot = AnnotLine(vp1, 0, 1, 1, 1)
Set lineAnnot = AnnotLine(vp1, 0, 0, 0, 1)
Set lineAnnot = AnnotLine(vp2, 1, 0, 1, 1)
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub handleCB1()
If geoMeanExist = TRUE Then
If VinkelKollGeo = "AntVal" Then
EnableButton 1 ,1
ElseIf VinkelKollGeo = "PostVal" Then
DisableButton 1, 1
End If
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", antVal
If antVal = 1 And postVal = 1 Then
SetControlValue conArea,CA_CHECKBOX,"ANTERIOR", FALSE
End If
If antVal = 0 And postVal = 0 Then
SetControlValue conArea,CA_CHECKBOX,"ANTERIOR", TRUE
End If
End If
If aritMeanExist = TRUE Then
If VinkelKollArit = "AntVal" Then
EnableButton 1 ,2
ElseIf VinkelKollArit = "PostVal" Then
DisableButton 1, 2
End If
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", antVal
If antVal = 1 And postVal = 1 Then
SetControlValue conArea,CA_CHECKBOX,"ANTERIOR", FALSE
End If
If antVal = 0 And postVal = 0 Then
SetControlValue conArea,CA_CHECKBOX,"ANTERIOR", TRUE
End If
End If
If geoMeanExist = FALSE And aritMeanExist = FALSE Then
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", antVal
If antVal = 1 And postVal = 1 Then
SetControlValue conArea,CA_CHECKBOX,"ANTERIOR", FALSE
End If
If antVal = 0 And postVal = 0 Then
SetControlValue conArea,CA_CHECKBOX,"ANTERIOR", TRUE
End If
End If
End Sub
'-------------------------------------------------------------------------------------------------------------------Sub handleCB2()
If geoMeanExist = TRUE Then
If VinkelKollGeo = "PostVal" Then
EnableButton 1 ,1
ElseIf VinkelKollGeo = "AntVal" Then
32
DisableButton 1, 1
End If
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", antVal
If antVal = 1 And postVal = 1 Then
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", FALSE
End If
If antVal = 0 And postVal = 0 Then
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", TRUE
End If
PostInstall = TRUE
End If
If aritMeanExist = TRUE Then
If VinkelKollArit = "PostVal" Then
EnableButton 1 ,2
ElseIf VinkelKoll = "AntVal" Then
DisableButton 1, 2
End If
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", antVal
If antVal = 1 And postVal = 1 Then
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", FALSE
End If
If antVal = 0 And postVal = 0 Then
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", TRUE
End If
PostInstall = TRUE
End If
If geoMeanExist = FALSE And aritMeanExist = FALSE Then
GetControlValue conArea, CA_CHECKBOX, "ANTERIOR", postVal
GetControlValue conArea, CA_CHECKBOX, "POSTERIOR", antVal
If antVal = 1 And postVal = 1 Then
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", FALSE
End If
If antVal = 0 And postVal = 0 Then
SetControlValue conArea,CA_CHECKBOX,"POSTERIOR", TRUE
End If
End If
End Sub
33
APPENDIX 2
CLINICAL EXAMPLE
Typical renography examination with ROIs around the kidneys. The upper left image show the anterior
view, the upper right the posterior and lower image is the geometric mean image. The ROIs are isocounts
with the same level for all images. The size of the ROI over the geometric image is intermediate the
posterior and the anterior images. This indicates that the kidneys have different coronal positions.
34
Typical renogram processing where background ROIs are present. The renogram reveals that the left
kidney has poor function.
© Copyright 2026 Paperzz