This task page enables you to draw closed contours on frames and calculate the enclosed area. You can draw groups of contours to represent the shape of an object, calculate its volume and view its shape as a surface rendered image. It is also possible to define a surface patch by drawing on a 3D surface that you have created and 'cutting' the patch out of this surface. Finally, you can also export or import surfaces using this task page.
|The draw task can be selected either by using the tabs at the top of the task pages, or by selecting from the task menu. To actually draw contours, you need also to select the drawing icon from the toolbar.|
Up to thirty objects can be drawn on the same data. Select the current object to be drawn with the drop-down menu at the top of the draw task page. Drawing in the image window will then add contours to this object.
There are three ways to draw a single contour of an object in the image window. Clicking and dragging will draw a line in this window: when you release the mouse button, it will automatically be joined up to form a closed contour. Alternatively, if you click and release without moving the mouse, the contour will be defined with individual clicks until you click near an existing point towards the start of the contour.
The final method for drawing contours is to use the thresholding controls in the task page. With thresholds enabled (by checking the 'thresholds' box), data in the current thresholded range will be displayed in magenta. If you click on any of the magenta regions, a contour will automatically be drawn around that region, using the actual data values and thresholds to define the exact location. The 'threshold edges' checkboxes in the task page control which borders are drawn around: 'all' will create contours around both the inside and outside borders of the magenta region, whereas 'inside' and 'outside' will only draw round the inner or outer edges. The accuracy with which this follows the region border is controlled by the current level of zoom in the review canvas. Zooming up close will generate a very accurate contour exactly following the edge, whereas zooming out will generate a contour around the region which ignores very small features. Hence it is possible to draw around regions even if they cannot be thresholded precisely.
If the 'Every frame' slider is set to anything other than zero, then clicking in a magenta region will automatically generate contours in every n frames, where n is the value of this slider. Only regions which are linked to the region on the current frame are segmented.
The sliders for controlling the thresholded data values can be used in two ways. If the first slider is less than the second, the thresholded data will be between these values, otherwise, it will be less than the first and greater than the second.
If you are drawing contours on data which has been acquired using multiple sweeps, these will be automatically clipped to the multiple sweep partition.
Once a contour has been drawn, it can be edited by clicking and dragging points on the contour. If you move a contour point over another point from the same contour, Stradwin will ask you if you want to split this contour at this point. If you move a contour point over another point from a different contour, Stradwin will ask you if you want to merge these contours at this point. If you click and drag a segment between points, an additional point will be inserted and then dragged. Once you are moving an existing point on a contour, clicking with the other mouse button while the first button remains down will result in additional points being added to the contour.
It is also possible to use parts of existing contours in a new contour: this is useful if you have created contours by thresholding the data (as described above) but parts of the contours are missing or incorrect due to a poorly defined threshold. Start drawing a new contour by clicking and releasing in one of the regions where a new section of contour is required. Then continue defining new contour points until you reach an existing (correct) section of contour. Now click on the nearest point in the correct contour. You will see an arrow appear, which defines the direction and location at which an existing contour will be used. If this arrow is incorrect, simply click some distance away from the contour and it will disappear. If it is correct, then click on the last point in the contour you want to use: that section will be added to the current contour. You can then continue defining as usual, clicking on the initial point to finish. Note both the new and partially used old contour will still exist at the end of this operation, and you will probably want to delete the old contour once you have finished.
Contours can be deleted by using the delete tool and drawing over the contour. As each contour is drawn over, it will appear slightly transparent. Once the mouse button is released, Stradwin prompts for whether you want to delete the selected contours or re-assign them to another object. If only a single contour is selected using this method, it is also possible to delete all the contours inside the selected contour, or delete contour concavities. In the latter case, the detected concavities will be displayed as contour points only, with no line passing through them. Alternatively, clicking on a single point will remove that point from the contour.
Contours can also be deleted or re-assigned in the 3D window, by exactly the same method. Simply use the delete tool to draw over the contours you want to select, then either delete or re-assign them.
Finally, if you want to delete all contours in a particular object, or all contours in this object in the current frame, there is a button on the task page beside each object definition which can be used for this purpose.
In order to estimate the volume of the object, you need to draw several contours, in different frames, such that the whole set of contours as seen in the 3D window is representative of the shape of the object. In particular, you should ensure that the first and last contour are close to the edges of the object. All the contours in the current object can be quickly located by using the 'Review contours' slider.
Once you have drawn several contours to represent one or more objects, you can get Stradwin to interpolate a surface through the contours and display a surface-rendered image of the object (or objects) in the 3D window. To do this you click on the 'Update' button (which just generates a surface for the current object), or alternatively the 'Update all' button. The interpolation resolution is set by the 'Surface resolution' control: higher values generate surfaces with more, smaller, triangles. The surface can be smoothed using the 'Smoothing strength' control. The 'Standard' smoothing ensures that the surface does not shrink as it is being smoothed, i.e. it is a type of volume-preserving smoothing. 'Pre-version 4.7' smoothing is just a simple average of neighbouring vertices.
If you edit one of the contours after creating a surface, the surface will revert to contours until you click the button to update it again.
Two checkboxes below these buttons control the precise way in which the contours are interpolated. The first, 'sparse contour interpolation', enables a more complex interpolation (maximal disc-guided shape-based interpolation) which will perform better when the contours are very different from each other or particularly sparse. The second checkbox 'triangulate over ends' causes the interpolation algorithm to extrapolate a surface after the last contour, providing the image data continues beyond this contour. The default behaviour (checkbox not ticked) is to stop at the last contour and just include a perfectly flat 'cap' at each end.
The 'Compounding depth' slider allows nearby image data to be projected onto the surface, producing a texture-mapped display: this is best appreciated when the surface's colour is set to black (see 'Object controls' below). Setting the slider to a negative value compounds data from within the object whereas setting it to a positive value will compound data from outside the object.
Generally, the best way to get a good representation of an object is to draw the minimum number of contours that are needed to effectively represent the shape. It is not necessary to outline the object on every frame.
When a surface is generated for each object, the centre of gravity of the surface is also calculated. This is displayed for the current object just below the area and perimeter for the current contour. The 'Find' button can be used to locate orthogonal views which intersect with the centre of gravity, as well as the nearest frame, just as the 'Find' buttons on the landmarks task page. This also temporarily sets the centre of rotation in the 3D window to the centre of the current object: changing the size of the window, or clicking in it with the 'zoom' tool will reset this behaviour.
The intersection of any existing surface is shown in the reslices and all the frames as a dotted line. These intersection lines cannot be edited.
You can delete the surface (without deleting the underlying contours) by using the 'delete' button for the corresponding object.
If you want to define a surface patch (i.e. a non-closed surface) you must first create a closed surface as above, which contains the patch you are interested in. Having done this, you can use the 'draw' tool to draw on the surface in the 3D window, and define the edge of the patch as a curve: see the landmark task page for more information on defining surface-based curves. The edge is drawn one point at a time, with the point always positioned exactly on the surface, underneath the draw tool.
You can change to the 'rotate' tool at any point in order to change the viewpoint. Otherwise the 'draw' tool can also be used to move existing points, or to insert points if you click on an existing line between two points.
The 'erase' tool can be used to delete an existing point, but it is also used to cut the surface once the curve has been defined. This is achieved in two stages. Firstly, click on one of the lines connecting two points, and you will have the option either to erase the whole curve or to split the surface using this curve. If you select the latter, the current surface will be split along this curve and the projection of the curve onto the surface will turn red to indicate this has been done. This splitting can also be achieved by using the 'split' button on the landmarks task page. At this stage, the patch is still regarded as being in the same object. You can repeat the splitting operation using further curves if the topology is complex and more than one split is needed to separate out the patch.
Once the surface has been split, clicking on the patch with the 'erase' tool will give you the opportunity to assign this patch to another object. After this, it can be exported separately: the patch will also be removed from the original object.
Note that there are some situations where the curve you have drawn might be ambiguous and the surface will not be split. If this is the case, the ambiguous segment will be highlighted in red, and you will then need to define some more points in this segment before attempting to split the surface again.
If you find that you are unable to select a line, try clicking slightly closer to one of the points at each end of the line: particularly if the line passes a long way from the actual surface.
All the contours which define a surface are saved in the stradwin files. So if you load this data again, you can re-create the surface by using the 'Update' button. If you want to export this surface (rather than just the contours), it can also be saved to either a PLY or a VRML file, using the 'Save' (for just the current surface) or 'Save all' (for all surfaces in the same file or set of files) buttons.
For regular data sets, for instance DICOM data, it is also possible to use these buttons to export the surface as a compressed NIFTI mask. This is a volume representation, aligned with the loaded data, which contains a value for each voxel corresponding to which stradwin object (if any) this voxel is inside. This can be used as a template in various external software packages.
Surfaces can also be imported directly into Stradwin if you have already generated segmentations (presumably in some other application) and saved them as either a PLY or a VRML file. Use the 'Import surface' button near the top of the page. Stradwin will then read in and display the surface, and additionally generate a set of contours that are consistent with this surface. If you edit the contours, Stradwin will discard the imported surface, though you can generate a new surface consistent with the edited contours using the 'Update' button.
Note that if the imported surface is a patch (i.e. it is not closed), then Stradwin will still generate non-closed contours, but will not be able to re-create the surface patch from these contours once the surface is deleted.
When importing a surface, Stradwin also looks for a file with the same name as the surface but with a '.mtx' extension. If such a file exists, it can be used to define a 4 x 4 homogeneous transformation matrix which will be applied to the surface as it is read in. The file should be in a simple text format, with four numbers on each of four lines, separated by spaces. These directly represent the transformation matrix you wish to apply to the vertices and normals (if defined) of the imported surface.
Note that Stradwin will not allow a surface to be read-in which does not overlap with at least some of the image data. Stradwin will only generate contours which intersect with the image data. If point normals have been defined in the file, these are used for display, otherwise they are calculated from the triangles.
The draw task page contains two lines of controls for each object. Firstly, there is a button which can be used to control the colour of the object. Next is a text control which can be used to label the object. After this is a label which shows the volume of the object. On the next line there is a check-box that you can use to indicate whether or not the object is solid and should have closed ends (though this does not work for imported surfaces, which are predefined as being solid or open in the PLY or VRML file). There is also a box to set the opacity of the object in the 3D window: setting this to zero will disable display of this object in the 3D window. Finally, there is a button which can be used to clear all contours for that object, or all contours in the current frame for that object, or just delete the 3D surface representation of the object.
There are also two key presses which affect the display of surfaces in the 3D window. Pressing a 'space' with the mouse cursor in the window will prevent display of the current frame (so surfaces can be more clearly seen). Pressing the 'L' key will toggle drawing of wireframe or shaded objects, so the triangulation of the surface can be seen.