User's Guide to Loc3D

 

 

Loc3D is a program that allows the user to locate scalp, subdural and depth electrodes in CT scans so that their locations can be passed to other programs for advanced analysis of EEG recordings. It is graphical and interactive, allowing the electrodes to be visualized in orthogonal slices or in a 3-D viewing window.    It includes a 3-D surface-rendering engine that can be set to show the electrodes, skull, or skin in translucent superimposition.  The electrode coordinates and labels are stored in a separate file in ASCII format.  The program runs in Windows, Macintosh and UNIX environments.

 

Loading a CT file into the program.

 

The initial step of loading a CT into the program for display is to initiate the 3-D Image Loader by pressing the Image dir button

 

 

It will appear in the upper left hand corner of the 3D Image Loader window, which appears after the executive window and the main display window.

 

Pressing the Image dir button will open a dialogue box that allows the user to specify the location of the CT slices.  It is convenient to place these slices in their own directory, for example, \CT\raw\.  It is possible to either type the path in the bottom of the window, or navigate to it by double-clicking in the left-hand white text window until the slice names appear in the right-hand white text window.  Once the proper path has been specified, press the OK button.  It is also possible to create new directories, rename files, or delete files during this process using the buttons at the top of the window.

 

 

If you have an info file, load it into the program by pressing the Info file button. (It is most convenient to place these files in the directory immediately above the .raw slices, in \CT.)  When the CT slice files read into the program, press the OK button.  The 3-D Image Loader box should disappear and you should be viewing the main screen of the program.

 

If you do not have a CT.info file which contains the CT slice parameters, you must specify them in the dialogue box.  Enter the CT scan parameters in the appropriate fields and press the Preview button.  It may be necessary to adjust the display parameter windowing to see the electrodes.  If a reasonable looking image appears in the viewing window, save the parameters as a .info file for subsequent file reading using the save buttons in the upper left hand corner of the window.  Any errors encountered by the program will be displayed in the separate python text window.

 

The contents of a typical CT.info file should appear like this:

 

                  order       : little endian

                  readerClass : vtkImageReader2

                  dimensions  : 512 512

                  dir         : "C:\patient\CT\raw"

                  prefix      : 1.2.840.113619.2.55.1.1762864819.1956.1073909138.

                  extension   : raw

                  pattern     : %d

                  first       : 540

                  last        : 651

                  dfov        : 25.000

                  spacing     : 0.125

                  header      : 0

                  mask        : None

 

 

Manipulating CT Images.

 

Once loaded, the CT scan will appear in the main image display screen.

 

 

Orthogonal Sagittal, Coronal and Axial slices (X, Y and Z) appear in the bottom half of the display.  When the cursor is placed in one of these windows the slices can be manipulated as follows:

 

                                    Mouse Button                    Outside Slice                          On Slice                                 

                                    Left                                         rotates       image                   specifies voxel

                                    Middle                                    translates  image                   moves slice

                                    Right                                      zooms       image                  adjusts brightness/contrast

                                    Scroll wheel                                                                           scrolls slices (bottom windows)

                       

The slices can be rotated by grabbing their corners with the middle mouse button.

 

The individual slices can be toggled on/off by depressing the x, y, and z keys

 

Although these commands seem complicated at first, you will soon be manipulating images rapidly and intuitively, like driving a car.

 

Marking electrodes manually.

 

The location of electrodes (subdural, depth, or scalp) and fiducial marks can be specified by placing the cursor on the proper voxel in any of the lower slices windows and depressing the letter I (insert) key.  Once several markers have been specified, the marker locations can be saved in a .csv file by depressing the Save or Save As buttons in the upper left hand corner of the screen.  It is best to save these files in the directory directly above the .raw slices.

 

Below is a partial listing of a typical .csv file specifying two grids, an anterior temporal grid (AT) and a frontal grid (FG).  It specifies the initials of the grid, the electrode number, the x, y, and z location, the diameter of the marker (cm), and the color of the marker (R,G,B).

 

 

            AT 1, 14.9173250198,12.8056297302,2.22503685951,0.2,1.0,1.0,0.0

            AT 2, 15.2265195847,12.1263885498,1.52502965927,0.2,1.0,1.0,0.0

            AT 3, 15.7701158524,11.3581075668,1.12502300739,0.2,1.0,1.0,0.0

            AT 4, 16.7496147156,11.0541238785,1.12502300739,0.2,1.0,1.0,0.0

            AT 5, 17.6365356445,11.0330295563,1.52502954006,0.2,1.0,1.0,0.0

            AT 6, 18.1680259705,11.2359180405,2.22501826286,0.2,1.0,1.0,0.0

            AT 7, 18.4630985206,11.5870294571,3.16866445541,0.2,1.0,1.0,0.0

            AT 8, 18.7632217407,11.9342985153,4.01633644104,0.2,1.0,1.0,0.0

            FG 1, 17.6149482727, 6.6354966166,3.11479210854,0.2,1.0,0.0,0.0

            FG 10,17.7105426788, 7.0218677528,4.08639955521,0.2,1.0,0.0,0.0

            FG 11,18.0762367249, 7.6686978341,4.36122751236,0.2,1.0,0.0,0.0

            FG 12,18.4852123206, 8.3820085525,4.65278196335,0.2,1.0,0.0,0.0

            FG 13,18.6995716095, 9.0922565460,4.92501735687,0.2,1.0,0.0,0.0

            FG 14,18.8313522339, 9.8319702148,5.24495124817,0.2,1.0,0.0,0.0

            FG 15,18.8702068329,10.5678987503,5.46353864607,0.2,1.0,0.0,0.0

            FG 16,18.9648284912,11.3496913901,5.83283567429,0.2,1.0,0.0,0.0

            FG 17,17.1353664398, 6.1005043983,4.43768882751,0.2,1.0,0.0,0.0

            FG 18,17.5279102325, 6.8154397010,4.71204471588,0.2,1.0,0.0,0.0

            FG 19,17.7807006836, 7.4458804130,5.10331487656,0.2,1.0,0.0,0.0

            FG 2,17.93380165001, 7.3329200744,3.39452219009,0.2,1.0,0.0,0.0

            FG 20,18.1970024109, 8.1065196991,5.35050582886,0.2,1.0,0.0,0.0

            FG 21,18.4329910278, 8.8107252121,5.69822359085,0.2,1.0,0.0,0.0

            FG 22,18.7148303986, 9.5195856094,5.90291547775,0.2,1.0,0.0,0.0

 

 

It is also possible to load the marker .csv files  by pressing the Markers button in the upper left hand corner of the screen.  If there is already a marker file loaded, the data will be appended to the existing file.  Markers (electrodes) that have been placed incorrectly can be removed by pressing the Delete button and then left clicking on the marker.  The latest command can also be undone by clicking on the Undo button.  The location of a marker can also be altered by pressing the Move button and then dragging the marker to a new location on the lower slices.  The colors of the markers can be changed by pressing the Choose button and selecting a new color and then pressing OK.  After a new color is selected, the electrode color is changed by pressing the paintbrush Color button, and then clicking on the marker.  Once the electrodes have been positioned and colored as desired, the marker can be labeled by pressing Label button and then left clicking on a marker.  Enter the text label in the dialog box and press OK.  Our convention is to label the electrode or fiducial point with letters, then a space, and then a number.  All of the above actions must be performed either in the upper left hand window or the three lower slice windows.  In order to interact with the images in the original manner, the Interact button must be pressed to restore the original functionality of the mouse buttons.  The labels may be turned on and off with the Toggle button.  The opacity of the CT slices and the colored markers can be manipulated by pressing the Planes button and moving the sliders.

 

 

             

3-D Surface Rendering.

 

It is possible to segment and view objects within the CT scan such as scalp, subdural, and depth electrodes, as well as the skull and scalp as a 3-D surface rendered objects.  This is done by pressing the Surface button at the top of the main display screen.  The initial surface rendering dialogue box will appear.

 

 

This box allows you to specify the properties of the object that you want to segment and render.  Using the default intensity value of 3000 nicely renders the very bright electrodes in our CT scans, as shown in the upper right window of the main display screen above.  Simply press the Add segment button and then the Render button.  Depending on the characteristics of your CT scanner, the intensity value may need to be adjusted.  If there are too many other objects in the screen, you can raise the value of the segmentation threshold, and repeat the process to eliminate them.  If the electrodes do not appear, or only partially appear, it may be necessary to reduce the intensity cut-off and re-render them. 

 

 

An alternative method is to let the program determine the proper intensity by pressing the Capture button and then moving the mouse over the desired object (e.g., and electrode) in one of the slice windows while depressing the left mouse button.  This will allow the program to capture the average brightness of the object and use it as the threshold.  It will appear in the value window.  The color of the rendered objects can be specified by pressing the Color button.  Be warned that if large objects are rendered, depending on your computer, it may take a few minutes to create the object.

 

The Surface renderer properties window has four other tabs.  Selecting the Views tab allows the viewport of the upper two windows to be matched.  Selecting the Segments tab allows you to hide or adjust the opacity of any of the 3-D rendered objects.  Selecting the Picker tab allows you to place fiducial marks or locate points on the selected 3-D object.  Finally, selecting the Pipeline tab allows you to specify advanced strategies to render image objects.  When multiple objects are identified by the rendering engine, filters allow you to either connect or decimate them. Isolated objects can be connected using six different strategies.  A large object can be decimated by specifying six filter settings.