Stradwin files

Stradview can load data from various DICOM and other image formats. However, it saves any additional data in the Stradwin file format, either as data files, or in a configuration file.

Data files are used to store position and analysis data, and can also be used to store images. They consist of pairs of files with the same name, but different extensions, ".sw" containing textual information and ".sxi" containing binary image data, except for DICOM data and image sequences, where the original files are used in place of the ".sxi" file. When you load up a data set in Stradview, the ".sw" file is loaded first to establish the details of the data set, and the ".sxi" file (or original DICOM or image file) is then loaded automatically. Since the ".sw" file contains unformatted text, it can be viewed and/or edited in any text editor. Equally, since the ".sxi" file is a simple binary file containing only the image data, it is generally straightforward to convert this to alternative formats, using the information in the ".sw" file.

The configuration file, "stradview.ini" (or ".stradview.ini" if you are using Linux) is used to store configuration information which is expected to be relatively stable for a given Stradview installation. This file is automatically updated whenever you change a control which is stored in this file, so that each time you start Stradview, such controls will be set to the values from the previous session. The configuration file also contains simple unformatted text, in the same format as the other text files.

Much of the information in configuration files is also stored in each textual ".sw" data file, so that the data contains a historical record of all the Stradview parameters at the time the data was recorded. When you load a data file, Stradview temporarily sets all the controls to whatever they were when you saved the data. These controls return to the previous settings as soon as the data file is closed unless you specifically change a control while the data is loaded, in which case it will then stay at the value you changed it to after closing the data file.

File formats

Most information in Stradwin text files is stored in single line parameter-value pairs, so for instance the line:

RES_BUF_FRAMES 100
indicates that the RES_BUF_FRAME parameter has the value "100". A few parameters can occur multiple times, for instance once per frame of data, or once per drawn contour.

The exception is the ".sxi" data file, which is a binary file containing image data only. For scan-converted data, this contains a single 8-bit (unsigned char) value per display pixel, and is ordered such that the pixel at row r, column c and frame f is at location:

f*RES_BUF_WIDTH*RES_BUF_HEIGHT + r*RES_BUF_WIDTH + c
Hence the total size of a scan-converted ".sxi" data file is given by RES_BUF_FRAMES*RES_BUF_WIDTH*RES_BUF_HEIGHT bytes.

Note that Stradview can not load RF data: for this you need to use Stradwin.

Stradwin coordinate systems

All rotations in Stradwin ".sw" data files are expressed in Euler angles. The particular convention used is Tait-Bryan angles, ZYX ordering, with azimuth = yaw = alpha, elevation = pitch = beta and roll = gamma. Internally, Stradview converts Euler angles to homogeneous transformation matrices before manipulation. The classes matrix16d and vertex3d for dealing with such matrices are contained in 'translate.h' and 'translate.cpp'. Using these classes, the following code snippet uses Stradwin parameters (as described below) to convert a pixel location in a single frame to the data coordinate system:

  // Create matrices for
  //  - position sensor calibration (cal), if required
  //  - frame location in position sensor coordinates (frame)
  matrix16d cal(res_xtrans, res_ytrans, res_ztrans, res_azimuth, res_elevation, res_roll);
  matrix16d frame(im_x, im_y, im_z, im_azimuth, im_elevation, im_roll);

  // Calculate vertices for
  //  - point location relative to the frame (pixels)
  //  - point location relative to the position sensing device (pos), if required
  //  - point location in position sensor base coordinates (world)
  vertex3d pixels, pos, world;

  pixels.x = 100;  // pixels from top left in horizontal direction
  pixels.y = 50;   // pixels from top left in vertical direction
  pos = cal * pixels.scale(res_xscale, res_yscale);
  world = frame * pos;

Note that, for most DICOM and image data, the "cal" matrix above is not used, and would be set to the identity matrix.

Single line parameters saved in the text data ".sw" file

The following table lists all the single line parameters that are stored in the ".sw" file, and possibly also the configuration ("stradview.ini") files. The first nine parameters are always located before the RES_END_HEADER token: Stradview needs to load these first in order to correctly interpret the remaining parameters. Apart from this restriction, the parameters can appear in any order in the file. The table also shows how some of the parameters are collected together into "groups": these are mainly used to warn the user of unsaved parameters when closing a file or quitting Stradview.

Token Data file Config file Type Default Group Description
RES_BUF_FRAMES long 0 DATA The number of frames of recorded data.
RES_BUF_WIDTH long 512 IMAGE The width of scan-converted data, in pixels.
RES_BUF_HEIGHT long 512 IMAGE The height of scan-converted data, in pixels.
RES_BUF_RF bool false IMAGE Whether the recorded data is RF or scan-converted. Note that RF data can not be loaded by Stradview.
RES_BUF_DICOM bool false DICOM Whether this header file refers to native DICOM data or image sequence files (true) or Stradwin ".sxi" files (false).
RES_DICOM_FRAME_LIST longs - DICOM An ordered list of values indicating which DICOM or image files or frames are included in this Stradwin file. A value of zero indicates the first DICOM/image file found in this directory.
RES_POS_REC bool true POS Whether we have locational data with each image.
# text - - Comment token - this can be followed by any textual comment.
RES_END_HEADER - - - A special token signifying the end of the header section.
RES_BIN_IM_FILENAME text - DATA The name of the binary ".sxi" file (including extension) to load with this ".sw" file. Alternatively, if RES_BUF_DICOM is true, the name of the first (lowest number) DICOM or image file to associate with this ".sw" file, or the directory containing these files.
RES_VERSION text 6.0 - The Stradwin version which wrote this file.
RES_CORRECTED_PRESSURE bool false IMAGE Whether the image data has been corrected for probe pressure using an image-based algorithm.
RES_CORRECTED_POS bool false DATA Whether the image data has been corrected for small positional errors using an image-based algorithm.
RES_MASKED_DATA long 0 IMAGE 1 if the image data has been masked (non-data areas set to zero and ignored in visualisations), 0 otherwise.
RES_INVERT_BSCAN bool false IMAGE Whether the probe surface is at the top (false) or bottom (true) of the displayed image.
RES_BUF_DOPPLER bool false IMAGE Whether the data is grey-scale (B-scan) or colour (Doppler).
RES_XTRANS double 0 POS The x (lateral) translation (in cm) from the top left corner of the image to the position sensor coordinate system.
RES_YTRANS double 0 POS The y (axial) translation (in cm) from the top left corner of the image to the position sensor coordinate system.
RES_ZTRANS double 0 POS The z (elevational) translation (in cm) from the top left corner of the image to the position sensor coordinate system.
RES_AZIMUTH double 0 POS The Euler azimuth (in degrees from -180 to 180) from the top left corner of the image to the position sensor coordinate system.
RES_ELEVATION double 0 POS The Euler elevation (in degrees from -90 to 90) from the top left corner of the image to the position sensor coordinate system.
RES_ROLL double 0 POS The Euler roll (in degrees from -90 to 90) from the top left corner of the image to the position sensor coordinate system.
RES_XSCALE double 0.01 POS The lateral (x) scale of the scan-converted image, in cm per pixel.
RES_YSCALE double 0.01 POS The axial (y) scale of the scan-converted image, in cm per pixel.
RES_POS_MANUAL bool false POS Whether the positions have been manually entered.
RES_POS_MANUAL_TRAN long 0 POS The axis (or 0 for no translation) for manually entered positions.
RES_POS_MANUAL_SPAN long 0 POS The total translation distance in mm for manually entered positions.
RES_POS_MANUAL_ROT long 0 POS The axis (or 0 for no rotation) for manually entered rotations.
RES_POS_MANUAL_ANGLE long 0 POS The total rotation angle in degrees for manually entered rotations.
RES_POS_MANUAL_RADIUS long 0 POS The offset radius in mm about which the rotations occurs for manually entered rotations.
RES_DICOM_HUM double 1.0 DICOM Part of the conversion between raw data values and Hounsfield Units (HU), where HU = (raw * DICOM_HUM) + DICOM_HUB.
RES_DICOM_HUB double 0.0 DICOM Part of the conversion between raw data values and Hounsfield Units (HU), where HU = (raw * DICOM_HUM) + DICOM_HUB.
RES_DICOM_WIN_WIDTH double 2048 DICOM The window width for DICOM display, in Hounsfield Units. The default value is whatever is stored in the corresponding DICOM files.
RES_DICOM_WIN_CENTRE double 1024 DICOM The window centre for DICOM display, in Hounsfield Units. The default value is whatever is stored in the corresponding DICOM files.
RES_DICOM_FILTER long 0 DICOM Applies a Gaussian filter of extent (2*RES_DICOM_FILTER+1) to the raw data before windowing, to remove noise. '0' turns this filter off.
RES_DICOM_BMD_PHANTOM text No DICOM The phantom which was detected in CT data and used to convert Hounsfield Units to density, or 'No' if this has not been done.
RES_DICOM_BMD_SCALE double 1.0 DICOM Part of the conversion between Hounsfield Units (HU) and density (mg/cm3), where density = (HU-BMD_OFFSET)/BMD_SCALE.
RES_DICOM_BMD_OFFSET double 0.0 DICOM Part of the conversion between Hounsfield Units (HU) and density (mg/cm3), where density = (HU-BMD_OFFSET)/BMD_SCALE.
RES_THICKNESS_SCALE_MM long 40 DICOM The maximum scale value (in tenths of a mm) for the surface colour map when displaying bone cortical thickness estimation from CT DICOM data.
RES_THICKNESS_SCALE_HU long 20 DICOM The scale value range (in 100 Hounsfield Units) for the surface colour map when displaying bone cortical density estimation from CT DICOM data.
RES_THICKNESS_ZERO_HU long 0 DICOM The minimum scale value (in 100 Hounsfield Units) for the surface colour map when displaying bone cortical density estimation from CT DICOM data.
RES_THICKNESS_SCALE_HUMM long 8 DICOM The scale value range (in 1000 Hounsfield Unit x mm) for the surface colour map when displaying bone cortical mass estimation from CT DICOM data.
RES_THICKNESS_TYPE long 0 DICOM The type of thickness algorithm used. This corresponds to the index (starting from zero) in the 'technique' choice in the thickness task page.
RES_THICKNESS_LINE double 1.8 DICOM The line length in cm for bone cortical thickness estimation from CT DICOM data.
RES_THICKNESS_GAUSS double 1e10 DICOM The std for the Gaussian blur in cm for bone cortical thickness estimation from CT DICOM data. 1e10 indicates the value should be estimated from the data.
RES_THICKNESS_RECT double 0.0 DICOM The size of rectangular blur in cm for bone cortical thickness estimation from CT DICOM data. 1e10 indicates the value should be estimated from the data.
RES_THICKNESS_A double 1e10 DICOM The external CT value in HU for bone cortical thickness estimation from CT DICOM data. 1e10 indicates the value should be estimated from the data.
RES_THICKNESS_B double 1e10 DICOM The cortical CT value in HU for bone cortical thickness estimation from CT DICOM data. 1e10 indicates the value should be estimated from the data.
RES_THICKNESS_C double 1e10 DICOM The trabecular CT value in HU for bone cortical thickness estimation from CT DICOM data. 1e10 indicates the value should be estimated from the data.
RES_THICKNESS_A_AVERAGE double 1e10 DICOM The average external CT value in HU for bone cortical thickness estimation from CT DICOM data. Only used when also modelling metal in CT data. 1e10 indicates the average has not been measured.
RES_THICKNESS_C_AVERAGE double 1e10 DICOM The average trabecular CT value in HU for bone cortical thickness estimation from CT DICOM data. Only used when also modelling metal in CT data. 1e10 indicates the average has not been measured.
RES_THICKNESS_CREATE_INNER bool true DICOM Whether to include the inner (endocortical) surface when creating a new surface from cortical thickness measurements.
RES_THICKNESS_CREATE_OUTER bool true DICOM Whether to include the outer (periosteal) surface when creating a new surface from cortical thickness measurements.
RES_THICKNESS_CREATE_CAPS bool false DICOM Whether to include the end cap (which closes the surface) when creating a new surface from cortical thickness measurements.
RES_THICKNESS_OUTLIER_REJECT long 40 DICOM When creating a surface from cortical thickness measurements, whether to exclude measurements which represent too high a curvature (less then given angle).
RES_THICKNESS_DISTANCE_REJECT long 40 DICOM When creating a surface from cortical thickness measurements, whether to exclude measurements too far away from the original surface (in pixels, 100 disables).
RES_THICKNESS_MAP_DIRECTION long 0 DICOM Corresponds to the 'Map direction' choice in the thickness task page, where 0 = 'Normal', i.e. do not change the measurement directions.

Multiple line parameters saved in the text data ".sw" file

The following parameters are followed by multiple values on each line. There can also be multiple copies of each parameter. For instance, there is one line of the form

IM time x y z azimuth elevation roll
for each frame in the data file, where each line gives a timestamp and the location and orientation of the image.

Token Data file Config file Values Group Description
IM time x y z azimuth elevation roll DATA One line per frame of data. The time (in 100 ns intervals), location x,y,z (in cm) and Euler angles (in degrees) of the position sensor at the point this image was recorded. The probe calibration values are also needed for conversion to the image coordinate system. If no positional information was recorded (RES_POS_REC false), this line only contains the time.
LANDMARK {type} {o} x y z {nx ny nz} name LANDMARKS One line per landmark (specific locations recorded by clicking on stored data). The location x,y,z (in cm) of this landmark in the position sensor base (world) coordinate system. If {type} is '2D' then z is the frame number. If type is 'SURF' then o is the associated object, and the surface normal {nx,ny,nz} is also stored.
CURVE o c x0 y0 z0 nx0 ny0 nz0 .. xn yn zn nxn nyn nzn name LANDMARKS One line per surface-based curve (a contour recorded by clicking on surface data). o is the associated object and c whether the curve is closed (0 or 1). The locations xn,yn,zn (in cm) and surface normals nxn,nyn,nzn are stored in order, followed by the name.
FIDUCIAL x y z name LANDMARKS One line per fiducial (specific locations recorded by using a tracked pointing device). The location x,y,z (in cm) of this fiducial in the position sensor base (world) coordinate system.
OBJECT n solid r g b a name OBJECT One line per object. The number n of the object, whether it is solid (0 or 1), the color r,g,b and transparency a, and the name.
CONT o f closed x0 y0 .. xn yn OBJECT One line per defined contour in the data. The number of the object o which contains this contour, the frame f in which it was defined, whether the contour is closed (0 or 1) and the x and y locations, in pixels from the top left corner of the frame, of the contour vertices.

Parameters saved only in the configuration "stradview.ini" file

Token Data file Config file Type Default Group Description
RES_BSCAN_OPACITY double 1.0 - The opacity of the strain image overlaid on a B-scan. If 1, the strain image is shown opaque.
RES_SEGMENT_TYPE long 2 - The topology for automated thresholding: 0 segments all contours, 1 segments only holes within the object, 2 only segments the outer body of the object.
RES_SEGMENT_FRAME long 0 - Whether to segment only the current frame (0, the default) or every nth frame, when using automated thresholding.
RES_SEGMENT_RANGE long 0 - Whether to restrict the segmentation to this distance (in mm) from the click point, when using automated thresholding. A value of 0 (the default) disables this feature.
RES_SEGMENT_RIDGES bool true - Whether to try to follow ridges which are below the threshold when automatically thresholding data. If this is false, stradwin will revert to the previous default of jumping over gaps in the thresholded data.
RES_JUMP_THRESH long 10 - The gap, in pixels, which may be included in an automated segmentation, despite not being within the threshold. If 'res_segment_ridges' is 'true', this is the maximum length of a ridge, otherwise it is the distance (in any direction) of the gap.
RES_SEGMENT_CONNECTED bool true - Whether to only segment objects which are connected with the initial click point (true, the default value) or segment every object which is currently thresholded.
RES_THRESH_BY_ZOOM bool false - Whether the automate the jump_thresh and simplify_thresh resources according to the current zoom in the main review window.
RES_SIMPLIFY_THRESH long 3 - When contours are created after thresholding, they are accurate to much better than a pixel, and contain very short segments. This threshold allows the contours to be simplified slightly, which increases the segment length, making the contours easier to edit. The default is '3' which is 0.3 of a pixel.
RES_RESLICE_OPACITY double 0.5 - The opacity with which the reslices are displayed in the 3D window. 1.0=opaque, 0.0=invisible.
RES_OUTLINE_VIEW_ANGLE long 45 - Whether to show the 3D visualisation as orthographic (0) or perspective (>0), in which case this gives the viewing angle in degrees.
RES_DISPLAY_PIXELS bool false - If set to true, turns off image interpolation in all windows, so that the actual data pixels are visible when the data is sufficiently zoomed.
RES_DISPLAY_COG bool true - If set to true, display centres-of-gravity of each surface in the 3D window, and in other windows when they are close enough.
RES_BACKGROUND text #323232 - The colour used for background (non-data) in the data windows, as three hexadecimal RGB values.
RES_GLUT_FONT long 4 - The font used to draw text in the graphics windows, as an index into the 'graphics font' selection box. This also controls the sizes of some other graphics elements.
RES_SEE_OUTLINES long 1 - Whether frame outlines are visible in the 3D windows, and intersections in the other windows. 0 - never visible, 1 - visible, just current frame, 2 - visible, all frames.
RES_SEE_MARK_LOCKED long 0 - Whether landmarks are permanently visible in all windows. 1 - always visible, 2 - never visible, 0 - automatic.
RES_SEE_DRAW_LOCKED long 0 - Whether contours and objects are permanently visible in all windows. 1 - always visible, 2 - never visible, 0 - automatic.
RES_MOUSE_SENSITIVITY long 5 - The number of pixels deemed to be a non-drag of the mouse, and the distance limit for selection.
RES_CURSOR_ROTATION long 5 - The angle to rotate by (in degrees) for each individual cursor press in the 3D and reslice windows, or on the tracker-ball.
RES_CURSOR_MOVEMENT long 5 - The amount to move by (in image pixels) for each individual cursor press in the 3D and ortho windows, or on the tracker-grids.
RES_SCROLL_ZOOM long 5 - The amount to increase or decrease the zoom by (in percent) for each individual scroll-wheel click in the 3D, review and reslice windows.
RES_USE_SCROLLBARS bool false - Whether to use scroll bars in all the visualisation windows, or to control zooming and panning using the mouse buttons.
RES_MOUSE_MIDDLE_OVERRIDE long 0 - Controls which tool the middle mouse button selects.
RES_MOUSE_RIGHT_OVERRIDE long 0 - Controls which tool the right mouse button selects.
RES_EXPERT_MODE bool false - If enabled, turns off various warnings and checks.
RES_ICON_SIZE long -1 - Determines whether the icon size is set (>=0) or automated according to screen size (-1).
RES_THICKNESS_DISP_MAP long 0 - An index (starting from zero) into the selection box for which property to map over the surface after thickness estimation.
RES_THICKNESS_DISP_COL long 3 - An index (starting from zero) into the selection box for which colour map to use in thickness estimation.
RES_SNAP_LANDMARKS bool true - Whether to constrain data-clicked landmarks to lie on one of the acquired frames.
RES_VRML2_SURFACES bool true - Whether to save surfaces in VRML2 format (true) or VRML1 format (false).
RES_DAT_THICKNESS_FILES bool true - Whether to save thickness files in the new DAT format with corresponding PLY surfaces (true) or the pre v5.2 format (false).
RES_PRESSURE_TASK bool false - If set to true in the config file, will enable the additional pressure task and panorama visualisation.
RES_SPINE_TASK bool false - If set to true in the config file, will enable the additional spine task and visualisation.
RES_DISPLAY_FEATURES long - - Used to control whether to display the Stradview version history on startup. Default value is related to current version number.