From SCIRun Documentation Wiki
Jump to navigation Jump to search

Instructions on How to Use Seg3d for Hand-Segmentation of the DEJ in Confocal Z-Stacks

A. Download and install

1. Download latest version of seg3d for windows, Release 1.9.4 the Seg3d website,

2. Install it.

3. Run seg3d. On a windows machine you can find it on the start menu or you can put a desktop shortcut during installation. On Linux it shows up under Applications->Education->Seg3D. It installs as any other application under OSX.

B. Loading a stack of images and manipulating the view

1. Make sure you have all the slices from a single z-stack in a folder by themselves.

2. Using File --> Open Volume, find the folder containing the series of images from a single stack and load them into Seg3D as a whole volume by selecting the any individual image file and then clicking on Open. Depending on the speed and memory of your computer this may take a little while.

3. The default setup in Seg3D gives you 3 orthogonal views and a 3D view. For hand-contouring this data it is probably easiest to look at the data only as a sequence of x-y slices. To do this go to the Views menu and select Single:

  Views --> Single

4. To go up and down the z-stack you can use the wheel on your mouse (assuming you have one)as long as the cursor is over the current image. Alternatively you can use the up and down arrows on the keyboard.

5. The default view is "upside down" with respect to the standard orientation we might expect, and in addition the up arrow moves down the stack. So before you start segmenting, correct the view by using the Tools / FlipTool panel:

a) To change the vertical orientation to "rightside up", choose

   FlipTool --> Flip around Coronal

b) To change the z-stack orientation so that the up arrow moves up the stack (towards the skin surface) choose

    FlipTool --> Flip around Axial

Again, depending on the speed and memory of your computer these operations may take a little while.

6. If you are working in the Single view mode looking at an x-y slice, and you want to get a view of where you are in the stack, you can always choose "Two by Two" from the View menu. The green lines in the coronal and saggital views will show you your z-stack location. To enlarge the x-y slice for contouring of course you can just then re-select the Single view.

7. You can change the brightness and contrast by holding the left mouse button down on the window showing the image and scrolling. Moving left/right it will adjust the brightness and moving up/down adjusts the contrast.

8. You can zoom by holding the right mouse button down and scrolling.

C. Hand-contouring using the Polyline Tool

1. First, Seg3D uses a "layer" interface somewhat inspired by Adobe Photoshop. So before starting any new series of operations you want to create a new layer. This is done by using the Volumes viewer on the right side of the Seg3D screen. This viewer shows a list of all "volumes", or layers. The active layer is always highlighted in blue.

2. To create a new layer for contouring, click on the plus sign on the listing for the initial volume and it will create a new layer. Note that the new layer is listed above the previous one and is highlighted in blue.

3. Contouring will be done by using the Polyline Tool, so open it:

    Tools --> Polyline Tool

This tool is extremely easy to use --- simply position the cursor on the image with the mouse and click the left mouse button. As you enter points they will be connected by lines so as to form a closed polygon. Some more detailed instructions on options to manipulate these drawings are described below, but first for clarity we describe how to "complete" the contouring segmentation.

4. To "finalize" segmenting an area on the image on the current slice with the Polyline tool, click on Fill on the Polyline Tool window on the left. The polygon enclosed by the polyline will then be shown as filled.

5. If you now go to another image in the stack (by using the up/down arrows) you will see the Polyline you just "finalized" as an open polygon on that image. If it sits where you want it to on the new image, you can just choose Fill again to finalize it on that slice. More likely you will want to edit it, using the features described next.

6. If you decide that you do not like your polygon after finalizing it, click on the Erase button on the Polyline Tool window and the fill will disappear, leaving just the open polygon. You can then manipulate it using the features described next and "refinalize" it when you are happy with it by clicking Fill again. You can also undo the most recent Fill or Erase by choosing the appropriate Undo entry from the Edit menu at the top.

7. As you move up and down the stack, the most recently Filled polygon outline will be visible on all images. To remove it simply click on Clear Polyline on the Polyline window. Note that any finalized polygons will not be affected.

8. Editing and manipulating the polygon as you draw:

  • Clicking and holding the right mouse button on an existing vertex allows you to drag it to a new location.
  • Clicking and holding the right mouse button on an existing line allows you to drag that point to a new location and then inserts a new vertex when you release the mouse button.
  • Clicking the middle mouse button on an existing point removes it and connects the neighboring points instead --- so this functions as a kind of "undo" button for a selected point.
  • Holding down the control key on your keyboard and clicking and holding the left mouse button allows you to drag the entire polygon around on the image.
  • Hitting the "f" key fills the polygon (same as choosing Fill on the Polyline Tool window).
  • Hitting the "c" key clears the current polyline (same as choosing Clear Polyline on the Polyline Tool window).
  • If you want to get rid of a polygon you have already finalized, you can always draw another polygon around it (remember to clear the current polyline first) then click on Erase to get rid of both the outer polygon you just drew as well as the older one inside it.

9. If you want to segment different kinds of features (so, for instance, as per our request, to segment dermis and also segment undesired and/or undetedermined regions), create a different layer for each by clicking on the plus sign again in the right panel for the original data volume that you loaded in. You can change the color by clicking on the color button for a particular layer. Then when you save volumes (see below), just make sure the volume you want to save is active when you execute the Save operation.

9. One note, when the Polyline Tool is active you cannot change brightness/contrast (since a left click places a point), so if you want to do so you need to close the Polyline tool (being sure to fill the latest polygon if you want to keep it), change contrast, then re-open the Polyline Tool.

D. Saving your work

1. The standard way to save once you are done segmenting a z-stack is simply to choose Save Volume from the File menu and give your work an appropriate name. The filename extension should be .nrrd, which Seg3D should suggest as the default. This .nrrd file is the one that will serve as the validation comparison for us. Note that before saving the segmentation volume (or layer), you should check to make sure that in the upper right corner the correct volume (or layer), the one that includes the contourings, is highlighted in blue. This should be the case if you are just carrying out the "normal" operations with only one kind of feature segmented, but if, as described in item 9 above, you segment several features in different layers then you will want to choose each one separately to save.

2. If you want to stop in the middle and resume work later, choose Save Session from the File menu and give the session a name you will remember. If you then close Seg3D and reopen it at a later time, by choosing Load Session from the File menu, and then choosing the ".ses" file which has the name you saved to, you can resume work from where you left off.

3. You can also save the session when you are done as well as saving each segmentation layer seperately. If you save the session when you are done you can come back and look at it later.

Written by:

Dana Brooks with input from Sila Kurugol and Michael Callahan Last update: July 12, 2008