3-D Object Modeling for Medical Imaging Porting to Ja

Document Sample
scope of work template
							3-D Object Modeling for Medical Imaging
 Porting to Java and User Interface Management




                        By
                 Pedro Maroun        Eid




                    A Senior Study




             Submitted in Partial Fulfillment of
        The Requirements of the Bachelor of Science
                   In Computer Science




             Department of Computer Science
          Faculty of Natural and Applied Sciences
                  Notre Dame University
                  Zouk Mosbeh, Lebanon




                        June 2002
                                              “When you have reached
                                              the mountain top, then
                                              you shall begin to climb,”
                                                      Gebran Khalil Gebran




                          A Dedication



      I take this opportunity to thank all who helped in this project

especially my advisor Dr. Khaldoun Khalidi. I also thank all who have

assisted me throughout these years of study, passing by all computer

science instructors to all the NDU Community. I thank all my friends

and classmates especially those who supported me in all my hard

times. A special thanks to those who made this possible for me to

accomplish; to my Parents, my family, and those who supported me

morally and financially. Thank you all.



                                                     With all my love,

                                                    Pedro Maroun Eid



                                                         July 24, 2003
                           Abstract

      This paper is part of a senior study based on an application that

simulates the Medical X-Ray Scanner. The application is a continuation

of a Master’s level study made at Besançon University, France. The

application was built using Enterprise Borland JBuilder 6.0. The main

part of this study is the transformation of the application into Java

code. A second part is the completion of the graphical user interface

which is not complete at this time. The X-Ray scanner is a device

which is given a body as input and it gives you the X-Ray image of that

body as output. Basically, the whole application requires a body as

input and, after the processing of this body, gives the output. The

output is easy to process whereas the input is the hard part. The input

is composed of a list of shapes, which keeps the intersections of the

shapes as well. The two basic shapes represented are the sphere and

the cylinder. As an assumption, one can make any body with these 2

shapes. Finally, this project, if complete, may serve as an experiment

or test platform.
                                    Table of Contents

   I.   A Dedication ..................................................................................................................i
  II.   Abstract..........................................................................................................................ii
 III.   Table of Contents ......................................................................................................iii
 IV.    Table of Figures .........................................................................................................iv
  V.    Introduction..................................................................................................................1
        1. Purpose:..................................................................................................................1
        2. Overall Geometry: ..............................................................................................2
        3. Requirements:......................................................................................................3
 VI.    The Simulator ..............................................................................................................4
        1. Definitions: ............................................................................................................4
        2. Object Model: .......................................................................................................5
        3. Other Objects: The Phantom, List of Inclusions......................................5
VII.    Requirement Analysis - Use Cases......................................................................7
VIII.   Static Design ................................................................................................................8
        1. Class Diagram (Appendix A): .........................................................................8
        2. The Phantom (Appendix A): ...........................................................................9
        3. Sphere and Cylinder (Appendix A): ...........................................................12
        4. Inclusion List: .....................................................................................................13
 IX.    Dynamic Design - Activity Diagrams................................................................15
        1. Acquire Phantom: .............................................................................................15
        2. Acquire Object: ..................................................................................................16
        3. Update Inclusion List:......................................................................................16
        4. Find Object:.........................................................................................................18
  X.    A Test............................................................................................................................20
 XI.    Conclusion ...................................................................................................................25
XII.    References ..................................................................................................................26
XIII.   APPENDIX –A- ...........................................................................................................27
        Class Diagram............................................................................................................28
        Phantom Class...........................................................................................................29
        Sphere and Cylinder Classes ...............................................................................30
XIV.    APPENDIX –B-: JAVA CODE .................................................................................31
                                              Table of Figures

    I.   Figure 1 ................................................................................................................................2
   II.   Figure 2 ...................................................................................................................................4
  III.   Figure 3 ...................................................................................................................................5
 IV.     Figure 4 ...................................................................................................................................7
   V.    Figure 5 ..............................................................................................................................15
 VI.     Figure 6 .................................................................................................................................16
 VII.    Figure 7 ..............................................................................................................................17
VIII.    Figure 8 ..............................................................................................................................18
 IX.     Figure 9 .................................................................................................................................20
   X.    Figure 10............................................................................................................................20
 XI.     Figure 11..........................................................................................................................251
 XII.    Figure 12..........................................................................................................................261
XIII.    Figure 13..........................................................................................................................272
XIV.     Figure 14..........................................................................................................................231
XV.      UML Class Diagrams...................................................................................Appendix –A-
3D Modeling for Medical Imaging - Porting to Java and UI Management          1




                                   Introduction


1.      Purpose:

     In medical imaging, Cone beam geometry is a revolutionary technology

that has been in research since years. This new technology is meant to

replace the traditional X-Ray scanner. This new concept in X-Ray scanners

is still under research for it needs highly accurate algorithms to give

accurate results for the processing of the reconstruction. Further

explanation will be provided later in this paper. The advantages of using

the cone-beam scanner rather than the traditional plane-based one are:

     Fewer Motion Artifacts

     Less Patient Discomfort

     No Problem of axial registration of reconstructed transverse sections

     The capability of stop-action reconstruction of dynamic organs in 3D.

     In order to test cone-beam scanners and determine their accuracy,

there is a need to form numerical models representing the organ of

interest. These models will be then used as input for the simulator to

process and deliver an image acquisition of the model. If this image was

the expected result from the original model then the scanner is

successful. Usually, simple models are used for first tests then complex

models for advanced test. [2]
3D Modeling for Medical Imaging - Porting to Java and UI Management       2



2.      Overall Geometry:

     The overall geometry of the phantom is first described by a body, the

phantom,         which        is    put
                                                Figure 1

between the X-Ray emitter

and receiver. As shown in

figure 1, the conic source

and the detector plane lie

before        and       after       the

phantom.         The       difference

between this layout and the

traditional one is that in the

traditional X-Ray scanner the

source is a plane X-Ray emitter not a cone. The cone emitter introduces

the need to analyze 3D surfaces not 2D like the traditional scanner. To be

able to analyze these 3D portions, density of object, shape, and nature

should be available as attributes for each simple object in the constructed

phantom. Obtaining the projection from only one position of the source

never renders 3D, so the source moves on a circular path around the

phantom and multiple (maybe thousands) projections are caught by the

detector plane which lies always opposite to the source.
3D Modeling for Medical Imaging - Porting to Java and UI Management         3



3.      Requirements:

     To create this simulator there are some generic steps to take. First, we

should be able to build a 3D volume phantom for the scanner to use and

analyze. Second, after shooting the phantom with X-Rays, we should be

able to obtain a radiographic X-Ray projection data from the given data of

the phantom. Third, this data will then have to be analyzed by a

reconstruction algorithm to obtain a reconstruction of the original

phantom. Finally, compare the reconstruction to the original volume. This

comparison reveals the accuracy of the algorithms used and determines if

the scanner is ready for use. However, a small error could remain

undetected and to be sure that the algorithm is highly accurate, a method

is usually performed; after obtaining the reconstruction of the phantom,

calculate its projection data and compare this data to the data obtained

from the actual phantom. If this data is the same, then the reconstruction

was good. [2]
3D Modeling for Medical Imaging - Porting to Java and UI Management                      4




                                 The Simulator


1.      Definitions:

     The simulator is basically constructed on some chosen techniques

which are provided as ways to construct such simulators. First, the

Sampling Techniques define the methods how to sample or partition the

phantom. One way is to have a density of the probability that shows the

interaction of the photons with the body. Another way is to use

mathematical algorithms to generate random numbers; each number

corresponds to an object in the phantom. Second, since the phantom will

be shot with X-Rays, we need to know how the photon interacts with the

objects. The photon has some direction in space which is moving in. It

normally       covers      a    distance       in    the

phantom, maybe reaches the detector                                   Figure 2   φ

maybe not. And most important, the                               Point of interaction
photon interacts with the phantom along
                                                                                     θ
its way by encountering some deviations

and filtering which change the path of

the photon and weaken it as shown in figure 2. Finally, we should mention

the variance reduction technique used by this simulator. [3]
3D Modeling for Medical Imaging - Porting to Java and UI Management              5



2.      Object Model:

        The object model used in the Monte Carlo simulator defines the

object that is processed. This object model will then be used to generate

a phantom. The object modeling used by this simulator is fundamental for

the simulation applied in tomography [1]. The phantom has some initial

attributes which define what it is and how it can be used. A phantom is a

collection of many basic shapes, so the shapes used in the phantom is an

essential detail which allows us to know how to operate and relate these

shapes to form one body. To differentiate between the different shapes

and parts of the phantom, we need another attribute which is the density

of the part we are dealing with. Since the phantom is made of different

simple shapes then each of these simple shapes should be assigned a

density. Finally, modeling is made by 2 different methods. Voxel-Based

modeling samples the phantom into different small parts (like cutting the

phantom into cubes) and Form-Based modeling uses a mathematical

expression to separate these different parts of the phantom. Basically,

with this simulator based on the Monte-Carlo simulator, we will be using

Form-Based modeling [3].
                                                                      Figure 3




3.      Other Objects:

        The modeling object forms the phantom. This phantom is a

combination of different simple geometric shapes like a sphere, an

ellipsoid, a cylinder, and a cube. These are shown in figure 3. With these
3D Modeling for Medical Imaging - Porting to Java and UI Management          6


basic 3D shapes, any common object could be formed. Basically, a head

for example could be formed from a sphere, an arm with a cylinder and

so on. Another object that is used in the simulator is the inclusion list [4].

In making the small parts of the phantom, bodies and shapes will have to

intersect at some point. This intersection is defined by relating the

intersection part made by the 2 shapes. Then, making it belong to or take

the attributes of one of the corresponding 2 shapes that form it. Then, to

store this inclusion information, an inclusion list which lists the objects

contained in a specific object is used. Surely, an object cannot contain

itself. The inclusion list is updated after each creation of a new object

unless the object created does not intersect any body already in the

phantom.
3D Modeling for Medical Imaging - Porting to Java and UI Management                                              7




        Requirement Analysis - Use Cases

        Use cases are used for specifying what this simulator has to

accomplish or, simply, its tasks. There are basically 4 important use cases

to perform for the simulator to work; shown in figure 4. The first is to be

able to acquire a phantom. In this step, the phantom should be initialized

with the object list, the inclusion list and all attributes related to the

phantom. In acquiring the phantom, the
                                                                       Figure 4
objects are acquired too. For example, if                                                   Acqui re Phan tom




you choose to put a sphere in a specific
                                                                                       Is Point Inside Phantom
place in the phantom, first, the object

attributes should be defined (center, radius,                     Sim ulator
                                                                                   Get Ray-Phantom Intersection
                                                                                            Poin ts List
density and nature). Next, the inclusion list

should be specified if this sphere has certain

intersections. The second use case needed                                         Get Distance traversed by the Ray
                                                                                        through the Phantom


is to be able to check if a point is inside the phantom. This use case is

given a point and it returns a Boolean specifying if this point is inside the

phantom or not. The function also returns a reference to the object

containing the point in question. The third use case defines that there

should be a way to return the intersection list. It is returned as a double

dimensional dynamic array of objects. Finally, the last use case should

return the distance traveled inside the phantom by a defined source (X-

Ray). It should be provided with a specific initial point and a direction that

it follows in.
3D Modeling for Medical Imaging - Porting to Java and UI Management                          8



                                  Static Design


1.      Class Diagram (Appendix A):

        The class diagram which is shown in Appendix –A- defines the

whole classes’ diagram. It shows the relationships between all the classes

and how they interact together. Details like attributes and methods are

hidden because of space conservation. They will be shown later.

        In this diagram, as it is shown, the phantom uses a class called

Intersector. This is an interface class which only defines methods that

could be used by the phantom or the interacting objects in the phantom.

These methods are static e.g. IntersectionSphereCylinder. Furthermore,

the phantom has a composition relationship with class SimulationObject

(or VShape). There could be only one phantom in the whole simulation

and this phantom can contain many SimulationObjects. So, a phantom

creates either a sphere or an ellipsoid as a SimulationObject. A

SimulationObject           is    a    generalization          of      Sphere   and   Cylinder.

SimulationObject uses IntersectionsPointList which supplies intersection

information in a structure that contains entering and exiting point and the

number of points intersected so far as values. Sphere and Cylinder are

the 2 basic 3D shapes that we will be dealing with. Both of these classes

are similar. They both use their own position classes since each has its

own 3D position in space. Sphere is expressed by a center and a radius

and cylinder by 2 centers a radius and a height. 4 essential classes are
3D Modeling for Medical Imaging - Porting to Java and UI Management                              9


also defined as global and these are: FPoint allows to specify a point in 3D

space, Vector specifies another point in space in addition to FPoint which

the Ray is moving towards, ObjectForm specifies the kind of object we

have     (sphere,      cylinder)      for    each     Simulation        Object,    and,   finally,

ObjectNature specifies the SimulationObject’s nature and therefore

density.




2.      The Phantom (Appendix A):

        Class Phantom is the main class in the whole simulator. It handles

the whole object the photon is passing in. Since the phantom is composed

of multiple basic shapes, it then deals directly with the generalization of

Sphere and Cylinder. This generalization, VShape, is a common interface

for   all   the    basic     shape      objects      used     for     creating    the   phantom.

Theoretically, VShape might be a Sphere, a Cylinder, an Ellipsoid, or a

rectangular cube. However, Ellipsoid and Cube are still not implemented

and Cylinder still has a problem with Cylinder-Cylinder Intersection. To

form the phantom, each shape must be acquired and defined as it is

created.

        The private attributes of Phantom describe the class’s special and

important fields. These fields keep trace of the instance of the created

phantom. ObjectsList stores the objects created by a corresponding

pointer to VShape. ObjectsList is of type Vector which is considered as a

resizable (dynamic) array (list). NbObjects stores the number of objects
3D Modeling for Medical Imaging - Porting to Java and UI Management        10


which are defined in the phantom till this point. It should be equal to

ObjectsList.size(). InclusionList is a double dimensional array which holds

all object inclusions. InclusionList is a Vector of Vectors. This List is

further explained in part 5 of this paper. IntersectionList is a Vector

Container [5] holding all detected intersections between any 2 objects or

set of objects. Currently this datatype is not used, but it could be needed

for future use. RayDirection is a locally defined Vecteur type. Vecteur

handles 3 measures in space defining a point where the ray is heading to.

IsEmitting is a Boolean function that returns the status of the emitting

source. This function is used to activate the detector array.

        The public data members are all methods defined for the user to

use to handle the phantom. They include the use cases described in the

Requirement Analysis Section of this paper. GetObjectsNumber counts the

created objects and assigns the obtained number to the private data

member NbObjects. AcquireObject opens a dialog for object creation. This

dialog asks all information required to set this object in space whether it

is a sphere or a cylinder (centers, radiuses and heights). Then if any

intersections are detected with previously created objects, the inclusion

dialog handles the inclusion list by the decisions of the user. ContainsPoint

returns true if the point specified lies in some object of the phantom and

returns by reference, a pointer to the object containing this point.

GetLocation converts a length on a Vecteur to a space coordinate. It is

given the vector attributes (initial point and direction) and a length on the

vector and it returns the space coordinate in a locally defined data type
3D Modeling for Medical Imaging - Porting to Java and UI Management                             11


point (X, Y and Z). GetPosition works opposite to GetLocation in

transforming the point in space to a length on a given vector.

GetIntersectionsList          returns       the     List    that      holds    the    intersection

information stored in InclusionList. UpdateInclusionList updates the

inclusion list based on the user’s specifications of the newly created

object. This function is accessed after each object creation if the

corresponding object has some intersections with other already created

objects. UpdateObjectInclusions updates the inclusion list with the

information that UpdateInclusionList gives to it. IsObject1EnteringObject2

detects and returns true if object 1 is entering in object 2. This is a

function that uses other functions to detect intersections. This function is

a set of cases; it gets the type (ObjectForm) of objects which are being

tested and calls the corresponding adequate                             function to perform

intersection       tests.    It   uses     functions       defined      in    class   Intersector.

FindIndexOfObjectContainingPoint gets the objectIndex containing the

corresponding point in the phantom. AddIntersectionInformation is used

to update the IntersectionList. Finally, GetDistanceThroughPhantom gets

the distance covered in the phantom by computing the distance covered

in each object in the phantom.
3D Modeling for Medical Imaging - Porting to Java and UI Management          12



3.      Sphere and Cylinder (Appendix A):

        Cylinder and Sphere are the 2 basic shapes currently implemented

in this simulation. As an assumption, everything could be formed from

these 2 3D shapes.

        Cylinder has as private attributes its position in space (the 2 centers

of the top and bottom circles and its single radius) and the conversion

matrices that convert a cylinder from its own coordinate system to the

main coordinate system of the whole space (phantom). The inverse

matrix does the inverse process. GetAttributes gets the cylinder attributes

(centers and radius) as specified by the user (corresponding to the

phantom’s coordinate system). GetPosition returns the position of the

cylinder in space using a class CylinderPosition that compacts the entire

cylinder’s information into one class. Cylinder Postion holds 2 centers, a

radius and a height of the cylinder. ContainsPoint returns true if the

specified point lies inside this specific cylinder. RandomPosition returns a

random point inside this cylinder. FindIntersection returns where the

photon entered and left in that specific cylinder. TrajectoryLength

computes the distance covered in that cylinder from the point where the

photon entered till the point that it left. The last 3 conversion methods

convert specific issues like points and vectors from the phantom’s

coordinate system to the cylinder’s and vice versa.

        Class Sphere defines a very similar structure to class Cylinder. It

has as private attributes its position in space (center and radius).

GetAttributes acquires the sphere’s position from user. GetPosition
3D Modeling for Medical Imaging - Porting to Java and UI Management                          13


returns the position of a sphere in space corresponding to the phantom’s

coordinate system. It uses SpherePosition, a class that holds the position

and shape information for class sphere. ContainsPoint returns true if the

given point is in this instance of sphere. RandomPosition gets a random

point inside this sphere. FindIntersection returns the entering and leaving

points     of   the     corresponding         photon       in   this   sphere.   And   finally,

TrajectoryLength computes the distance from the point of entry till the

point of quit in this sphere by the corresponding vector.




4.      Inclusion List:

        The inclusion List, as said before, holds all inclusion data between

any 2 objects. From this list, you can infer any inclusion information for

any number of objects inside the phantom. The list is a double

dimensional dynamic list (or array) which uses dynamic allocation for

holding objects. This is to preserve space and to create the list as it is

needed (no wasted resources). After object creation, the list dialog asks

the user what to do with the detected intersecting objects. The user has

to put each object either in the entering or in the including list. If an

object is put in the entering list then the intersection between this object

and the newly created one belongs to the new object. Whereas, if the

object intersecting the new one is put in the including list then the

intersection belongs to the object which is being specified. The list

manages the objects by the corresponding object number (ObjectIndex).
3D Modeling for Medical Imaging - Porting to Java and UI Management          14


At position i, this list has all intersections of specified objects for the ith

object created. Therefore, each new object created is assigned a number

equal to (ObjectsNumber+1) and is allocated a space at the end of the

inclusion list. When inclusion information should be viewed, 2 objects

should be specified and both allocations should be searched. For example,

if object 2 and 5 are being processed, the double dimensional list is

accessed at position 2 and the resulting simple list is searched for object

5 and then it is also accessed at position 5 and the simple list is searched

for object 2. First, It is impossible for both to include each other. Then, if

no one of them does include another then they do not intersect (this

could be know by another function called IntersectionObject1Object2

which is defined in the intersector class). If object 2 contains a node

saying 5 then object 5 is including object 2 or object 2 is entering object

5. Else if object 5 contains 2 then object 2 is including object 5 or object 5

is entering object 2. Finally, this list is a powerful data structure which

handles 2 way dynamic allocations and is fully compatible here with the

simulator. It will be harder to use any other method or structure.
3D Modeling for Medical Imaging - Porting to Java and UI Management                                                    15




     Dynamic Design - Activity Diagrams


1.      Acquire Phantom:
                                                                                  Wait for User
        Acquire Phantom is the main                                                Select ion


use case in this simulator. It takes

care of manipulating and handling
                                                              [ create obj ect sele cted ]

the newly defined objects. It fills                                               Acquire Object


the Inclusion and Object Lists so

that other use cases work on
                                                              [ nb of objects = 1 ]
                                                                                             [ n b of obje cts > 1 ]
them. The main sequence of the
                                                                                     Update
simulator is defined by activity                                                  Inclusion List
                                                           Figure 5
diagram 5. The start point is

marked with the single round black dot at the top of this diagram. First,

the simulator waits for a user selection. If an action occurs and an object

is selected, acquire this object. Else, if action is exit go to the end state

which is marked by the circled black dot. After acquiring the selected

object, if number of objects is equal to 1, then no intersections with other

objects; go back to step 1. Else if this number is greater than 1, Update

the Inclusion List and proceed to main menu (step 1).
3D Modeling for Medical Imaging - Porting to Java and UI Management                                       16



2.      Acquire Object:

        In Activity Diagram 5, step 2 calls acquire object to handle the

chosen object to be inputted from the user. After selecting the shape type

in Acquire Phantom, Acquire Object is used to get all required info on the

object you are modifying
                                            Figure 6
to the Phantom. It asks
                                                                  Wait for User
for the nature of this                                             Selection


object (in other words,                           [ sphere selected ]       [ cylinder selected ]


the     density)       and     its
                                              Acquire                                       Acquire
                                              Sphere                                        Cylinder
attributes (center(s) and

radius). Activity Diagram 6 shows the process of acquiring an object.

First, after choosing the type of object needed in the main process

(Acquire Phantom), this process checks the type of shape selected. If this

shape is a sphere, function Acquire sphere is called to handle the inputted

values. Otherwise, if Cylinder was selected, Acquire Cylinder is called to

handle the input. After acquiring the object, the main window appears

again waiting for a new choice. If the next choice is exit, this diagram

goes to its end state which continues the process through diagram 5.




3.      Update Inclusion List:

        State     3    of    Acquire     Phantom         defines        Update       Inclusion         List.

UpdateInclusionList is activated automatically on the condition that a

certain object which is being created has intersections with other objects
3D Modeling for Medical Imaging - Porting to Java and UI Management                                               17


in the Phantom. If this condition is not true, the inclusion dialog does not

appear. Normally the first object in the phantom has no intersections with

previously created objects obviously. UpdateInclusionList works and

manages the inclusion List defined in class Phantom. First, for activity

diagram 7 to proceed, a list of

values should be available. The
                                                                      Object Index
                                                                      Inclus ion Lis t
objectIndex             defines         the                           lis t of:indexes of objects including the
                                                                      current object (Including Lis t)
                                                                      lis t of:indexes of objects entering the
currently        created          object’s                            current object (Entering Lis t)


index. The whole inclusion list
                                                               [ Including Lis t not em pty ]
which will be updated is made
                                                    Update Inclusion List
available.        Finally,      2      lists         from Entering List

                                                                                   Including
forming        the      entering       and
                                                                [ Entering Lis t not em pty ]
including        list     should         be
                                                    Update Inclusion List
                                                     from Entering List
specified         from        all       the

intersecting objects with the                                                        Figure 7


currently created object. These

2 lists are specified by the user who puts each intersecting object in either

the entering or the including list. After the user’s specifications, if the

including list is not empty, we update the inclusion list from the including

list. Then, if the entering list is not empty, we update the inclusion list

from the entering list. Entering is when the object specified is entering or

taking a part of the new object and including is when the new object is

entering or taking a part from the specified object.
3D Modeling for Medical Imaging - Porting to Java and UI Management                                          18



4.      Find Object:

        Find Object is not related to any of the previous activity diagrams.

It is used to get the index of the object containing a specified point. First,

this function should be provided with a point to search for and a pointer

to an objectIndex. This pointer will then be redirected to the object



              Figure 8

                                                                               Point
                                                                               Obj ect Index
                                                    Find all Objects
                                                   containing the point

                                                                               list of:Indexes of O bjects
                                                                               (exc luding Objec t Index)
                                                                               contai ning Point



                                                                     [ li st empty ]

                                            [ list not empty ]

                                                Find all objects entering
                                                   the current object


                                                                                  list of:Indexes of
                                                                                  Objects entering the
                                                                                  current object


               Object Index = first   [ size of list > 1 ]            [ list empty ]
               element in the list
                                            [ size of list = 1 ]


                                                   Object Index = first
                                                   element in the list




containing the specified point. As in Activity Diagram 8 - state 1, we find

all objects containing the given point. Upon this list of objects, we test if

the list is empty or not. If it is empty we reach the end state (Point is not

in Phantom) else we find, from the inclusion list, all objects entering the

current object. The initial current object is the first object in the list
3D Modeling for Medical Imaging - Porting to Java and UI Management          19


containing the point. If the list of all objects entering the current object is

empty, go to the end state else if its size is greater than 1, we assign the

current object index to the first element in the list of entering objects. We

repeat this process till there are no more elements in the list of entering

objects. Then this list contains only 1 object which is the object containing

the corresponding point. The returned pointer is assigned to the

ObjectIndex of the single element of this list. This pointer is then given to

the user for further processing.
3D Modeling for Medical Imaging - Porting to Java and UI Management                         20




                                           A Test

        In this part, we will try to construct a phantom using the Java

Application and then process the whole thing so that we get reasonable

output values. This figure shows a section cut of 5 bodies considering only

spheres. This is our phantom (Figure 9).




                                                                      Figure 9



        When the application began, its main window containing the main

functions appears. As discussed before, a phantom is made of many

                                                                        shapes. The list

                                                                        on       the      main

                                                                        dialog     lets    you

                                                                        choose the shape

                                                                        you      need.     We

                                                                        also specified in

                                                         Figure 10      this     part      the

direction of the ray that is hitting the Phantom (along Z-axis).
3D Modeling for Medical Imaging - Porting to Java and UI Management                 21


                                  For simplicity, we will create the objects along

                          only 1 axis. In the ‘Create Sphere’ dialog, the user has

                          to put the sphere attributes known by the center(x, y,

                  and z) and the radius of the sphere. As in Figure 9 of
        Figure 11
the phantom above, Object 1 is a sphere with center (0, 0, 5) and radius

= 5. This first object surely doesn’t have intersections with other objects

and thus the inclusion dialog doesn’t appear. We then create Object 2

which is another sphere with center (0, 0, 2) and radius = 2. This second

object intersects Object 1. The algorithm detects this intersection and

displays the inclusion dialog. In this example, ‘Sphere 2’ is intersecting

‘Object 1’. The dialog asks the user to classify the intersection as

belonging or not to the object created. ‘Is Including’ classifies ‘Sphere 2’




                                                                        Figure 12

to be included in the object specified in the combo box or, simply, ‘Object

1’ is including ‘Sphere 2’. ‘Is Entering’ classifies ‘Sphere 2’ to contain the

object specified in the combo box or, simply, ‘Object 1’ is entering
3D Modeling for Medical Imaging - Porting to Java and UI Management                              22


‘Sphere 2’. After pressing the required button in the above form, the

object disappears from the combo box and is added to the corresponding

list. In this same way, we define all the remaining objects and their

intersections.

        After each definition, the ‘Show List’ button on the main form shows

the updated inclusion list. After all the definitions as shown in Figure 9,

                                                                             the inclusion list

                                                                             should            look

                                                                             something         like

                                                                             Figure     13.    The

                                                                             first   column      in

                                                                             this table shows

                                                                             the list of all the

                                                                             objects.         Each

                                                                             row     defines    all

                                                                             the         objects

                                                                 Figure 13   included in the

main object of the first column. For example, since all objects are

included in ‘Object 1’ as in Figure 9, then all these objects are listed in the

first row after ‘Object#1’. Also consider Object 3 which is including

objects 2 and 4 as in Figure 9 and so on.

        Now the model is constructed and the phantom exists virtually. The

next step is shoot the phantom with X-Rays and get a reasonable output

that detects the different bodies contained in the whole model. As
3D Modeling for Medical Imaging - Porting to Java and UI Management                                23


specified in the main window (Figure 10), the ray to be shot is heading

towards the Z-axis. After pressing the ‘Test’ button in Figure 10, a little

processing is done and Figure 14 below is shown. This figure shows the

                                                                      intersections along the

                                                                      different available axes

                                                                      and the object that the

                                                                      corresponding           point

                                                                      belongs to. Since the ray

                                                                      is heading in the Z-axis

                                                                      direction,   then      it    is

                                                                      reasonable      that        the

                                                                      intersections     detected

                                                                      are along the Z-axis. As

                                                                      in Figure 9, ‘Object 2’

                                                                      contains point (0, 0, 0)

                                                     Figure 14        and since ‘Object 2’ is

entering ‘Object 3’, then the ray doesn’t hit ‘Object 3’ until point (0, 0, 4).

The ray then leaves ‘Object 3’ at point (0, 0, 6) since ‘Object 4’ is

entering ‘Object 3’ and so on till the ray ends up leaving the phantom at

point (0, 0, 10) through ‘Object 1’. The form in Figure 14 also displays the

distance that was covered in the phantom which is 10.0 units in our

example. In this same form, the user can check if a certain point lies in

the phantom and in which object. Point (2, 3, 6) occurs to be in the

phantom but the object number that should be returned to this form is
3D Modeling for Medical Imaging - Porting to Java and UI Management    24


failing to return. This is a simple bug that should be corrected.

Supposedly, Objects in Java act as pass-by-reference all the time, but it

appears that it is not the case for all Java Objects.

        This simulation shows that given a certain phantom, the algorithm

can process intersections and shoot the whole with an X-ray and then

remodel the phantom from the points hit by the multiple rays.
3D Modeling for Medical Imaging - Porting to Java and UI Management             25




                                     Conclusion

        In hope that this study will be complete in the near future, it will

serve as a new and faster tool for medical imaging. The new tool will

provide faster, more comfortable and interrupted X-Ray scanning

possibilities because of its unique 3D architecture which is more than a

revolutionary change to the classical plane projection X-Ray scanner

already in use. The Java application still needs little refinements in its UI

and the completion of the detector plane (array) that stores the projection

data. It also needs user testing for bug elimination.
3D Modeling for Medical Imaging - Porting to Java and UI Management         26




                                     References


[1]     Masters’ Project: Simulation of the tomography of transmission by
      gamma rays, Nathalie Sin and Jacques Zaninetti, Besançon, 1994.
[2]     Simulations and mathematical models, Altschuler and Chang and
      Chu, 1980.
[3]     The Monte Carlo Simulator, 19--.
[4]     Data Structures in C++, Mrs. Nouhad Rizk, NDU, 2001.
[5]     JBuilder 6.0 Tutorials and Help Tools, 2002.
               27




APPENDIX –A-
                28




Class Diagram
                29




Phantom Class
                                                                                                            30




                Sphere and Cylinder Classes



                                                 Cylinde
ra di us : R eal
ce nter1 : Poin t
ce nter2 : Poin t
ch angeM atr ix : R ea l[ 4] [4]
inv e rse C ha ng eMa trix : Re al[ 4][ 4]

ge tA tt rib ute s( )
ge tP os iti on() : Cy li nd er Posit ion
co ntains Point (po int : Point ) : Bo ol ea n
ra nd om Posit ion( ) : Po int
f ind Int er sec tio n(in itialPo int : Po int , d ire ctio n : Ve cto r) : In te rse ctio ns Po int List
tr aje cto ry Le ng th( initia lPoint : Poin t, dir ect ion : Vect or )
co nv er tS y st em Co ord inatePo intT oCy lin der C oo rd inat es( po int : Point ) : Po int
co nv er tS y st em Co ord inateVe cto rT oCy lind er C oo rdin at es( v ect or : Vector ) : Ve cto r
co nv er tC ylin der Co ord inat eP oin tT oSy stem C oo rd inat es( po int : Point ) : Po int




                                                   Sphere
radius : Real
center : Point

getAttributes()
getPosition() : SpherePosition
containsPoint(point : Point) : Boolean
randomPosition() : Point
f indIntersection(initialPoint : Point, direction : Vector) : IntersectionsPointList
trajectory Length(initialPoint : Point, direction : Vector)
               31




APPENDIX –B-

						
Related docs