Draw

This task page enables you to draw closed contours on frames and calculate the enclosed area. You can also draw groups of contours to represent the shape of an object, calculate its volume and view its shape as a surface rendered image.

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.

Drawing object contours

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.

Editing object contours

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.

Contour area, object volume, and 3D visualisation

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.

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).

The surface can then be saved to a VRML file, if you wish, using the 'Save' (for just the current surface) or 'Save all' (for all surfaces in the same file) buttons. 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.

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.

Importing surfaces

It is possible to import surfaces directly into Stradwin if you have already generated segmentations (presumably in some other application) and saved them as a VRML file. Use the 'Import surface' button near the top of the page. Stradwin will then read in and display the VRML 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.

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.

Object controls

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 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.

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.