Plus applications user manual  2.9.0.bf99f0e
Software library for tracked ultrasound image acquisition, calibration, and processing.
Sequence metafile editor (EditSequenceFile)

This is a command-line tool for editing sequence metafiles. Operations include deleting frames from a file (TRIM command), append sequence metafiles (APPEND command), adding/deleting/changing data fields (..._FIELD_... commands), compress/uncompress the image data (–use-compression switch).

Examples

Generate sequence metafile that contains ImageToReference transforms

EditSequenceFile.exe --operation=ADD_TRANSFORM --add-transform=ImageToReference --config-file=PlusDeviceSet_fCal_Sim_VolumeReconstruction.xml  --source-seq-file=fCal_Test_Calibration_3NWires_fCal2.0.mha --output-seq-file=test.mha

Multiple transforms can be added, the names are separated by commas (do not add spaces):

EditSequenceFile --operation=ADD_TRANSFORM --add-transform=ImageToReference,ProbeToReference,TrackerToReference --source-seq-file=fCal_Test_Calibration_3NWires_fCal2.0.mha --output-seq-file=test.mha

Compress a sequence metafile

EditSequenceFile.exe --source-seq-file=[inputFilePath] --output-seq-file=[outputFilePath] --use-compression

Uncompress a sequence metafile

EditSequenceFile.exe --source-seq-file=[inputFilePath] --output-seq-file=[outputFilePath]

Trim a long sequence

Create a small test data file from the first 24 frames of a tracked ultrasound metafile:

EditSequenceFile --operation=TRIM --first-frame-index=0 --last-frame-index=23 --source-seq-file=e:\data\AdultScoliosis-T2.mha --output-seq-file=e:\data\AdultScoliosis-T2-24frames.mha

Use fill image rectangle for anonymization

Anonymization of sequences that contain patient information burnt into the pixels is enabled by the FILL_IMAGE_RECTANGLE operation, e.g.,

EditSequenceFile --operation=FILL_IMAGE_RECTANGLE --fill-rect-origin 52 25 --fill-rect-size 260 25 --fill-gray-level=20 --source-seq-file=SegmentationTest_BKMedical_RandomStepperMotionData2_Trimmed.mha --output-seq-file=SegmentationTest_BKMedical_RandomStepperMotionData2_Trimmed_Anonymized.mha

Input image:

ApplicationEditSequenceFileNonAnonymized.png

Image after fill rectangle operation:

ApplicationEditSequenceFileAnonymized.png

Remove image data from meta file, keep only the transforms

Saves only the tracker data from a meta file that has both tracker and image data.

EditSequenceFile --operation=REMOVE_IMAGE_DATA --source-seq-file=[inputFilePath] --output-seq-file=[outputFilePath]

Add a constant transform to each frame

EditSequenceFile --operation=UPDATE_FRAME_FIELD_VALUE --source-seq-file=[inputFilePath] --output-seq-file=[outputFilePathTmp] --updated-field-name="StylusTipToStylusTransform" --updated-field-value="1  0  0  182.18    0  1  0  0.0744143    0  0  1  14.3197    0  0  0  1"
EditSequenceFile --operation=UPDATE_FRAME_FIELD_VALUE --source-seq-file=[outputFilePathTmp] --output-seq-file=[outputFilePath] --updated-field-name="StylusTipToStylusTransformStatus" --updated-field-value="OK"

Mix multiple sequence files into one

Create one sequence file that contains video of the first sequence and transforms from all others.

EditSequenceFile --operation=MIX --source-seq-files [videoInputFilePath] [transform1InputFilePath] [transform2InputFilePath] --output-seq-file=[outputFilePath]

Command-line parameters reference

  --add-transform=opt  Name of the transform to add to each
                                          frame (e.g., StylusTipToTracker);
                                          multiple transforms can be added
                                          separated by a comma (e.g.,
                                          StylusTipToReference,ProbeToReference)

  --config-file=opt  Used device set configuration file
                                          path and name

  --decimation-factor=opt  Used for DECIMATE operation, where
                                          every N-th frame is kept. This
                                          parameter specifies N (Default: 2)

  --field-name=opt  Field name to edit

  --fill-gray-level=opt  Rectangle fill gray level. 0 = black,
                                          255 = white. (Default: 0)

  --first-frame-index=opt  First frame index used for trimming
                                          the sequence file. Index of the first
                                          frame of the sequence is 0.

  --flipX  Flip image along X axis.

  --flipY  Flip image along Y axis.

  --flipZ  Flip image along Z axis.

  --frame-scalar-decimal-digits=opt  Number of digits saved for frame
                                          scalar field value into sequence file
                                          (Default: 5)

  --frame-scalar-increment=opt  Frame scalar field value increment
                                          (Default: 1.0)

  --frame-scalar-start=opt  Frame scalar field value starting
                                          index (Default: 0.0)

  --frame-transform-increment=opt  Frame transform increment 4x4
                                          transform matrix (Default: identity)

  --frame-transform-index-field-name=opt  If specified then increment is
                                          applied as many times as the value of
                                          this field

  --frame-transform-start=opt  Frame transform field starting 4x4
                                          transform matrix (Default: identity)

  --help  Print this help.

  --increment-timestamps  Increment timestamps in the order of
                                          the input-file-names

  --last-frame-index=opt  Last frame index used for trimming
                                          the sequence file.

  --maintain-custom-headers opt opt ...  List of custom header fields to pass
                                          through to output file.

  --operation=opt  Operation to modify sequence file.
                                          See available operations below.

  --output-seq-file=opt  Output sequence file name with path
                                          to save the result

  --rect-origin opt opt ...  Fill or crop rectangle top-left
                                          corner position in MF coordinate
                                          frame, in pixels, separated by space
                                          (e.g., --rect-origin 12 34).

  --rect-size opt opt ...  Fill or crop rectangle size in MF
                                          coordinate frame, in pixels,
                                          separated by space (e.g., --rect-size
                                          56 78).

  --source-seq-file=opt  Input sequence file name with path to
                                          edit

  --source-seq-files opt opt ...  Input sequence file name list with
                                          path to edit

  --update-reference-transform=opt  Set the reference transform name to
                                          update old files by changing all
                                          ToolToReference transforms to
                                          ToolToTracker transform.

  --updated-field-name=opt  Updated field name after edit

  --updated-field-value=opt  Updated field value after edit

  --use-compression  Compress sequence file images.

  --verbose=opt  Verbose level (1=error only,
                                          2=warning, 3=info, 4=debug, 5=trace)


Operations: 

- UPDATE_FRAME_FIELD_NAME: update per-frame field names for each frame. If field does not exist then it is added.
  Requires --field-name and --updated-field-name.
- UPDATE_FRAME_FIELD_VALUE: update per-frame field values for each frame, if not exists add it.
  Uses --field-name, --updated-field-name, --updated-field-value, --frame-scalar-*, --frame-transform-*
- DELETE_FRAME_FIELD: delete per-frame field (field values specified for each frame).
  Requires --field-name.
- UPDATE_FIELD_NAME: update field name, if not exists add it.
  Requires --field-name and --updated-field-name.
- UPDATE_FIELD_VALUE: update field value, if not exists add it.
  Requires --field-name and --updated-field-value.
- DELETE_FIELD: delete field with name specified.
  Requires --field-name.
- ADD_TRANSFORM: add specified transform.
  Requires --add-transform.
- TRIM: Trim sequence file.
  Requires --first-frame-index and --last-frame-index.
- DECIMATE: Keep every N-th frame of the sequence file.
  Requires --decimation-factor.
- APPEND: Append multiple sequence files (one after the other).
  Set input files with the --source-seq-files parameter.
- MIX: Merge fields stored in multiple sequence files.
  Timepoints are defined by the first sequence. Image data is taken from the first sequence.
  No interpolation is performed, fields are copied from the frame with the closest timestamp.
  Set input files with the --source-seq-files parameter.
- FILL_IMAGE_RECTANGLE: Fill a rectangle in the image (useful for removing patient data from sequences).
  Requires --rect-origin, --rect-size, and --fill-gray-level. E.g., --rect-origin 12 34 --rect-size 56 78)
- CROP: Crop a rectangle in the image (useful for cropping b-mode image from the data obtained via frame-grabber).
  Requires --rect-origin and --rect-size. (e.g., --rect-size 56 78). Optional: --flip*.
- REMOVE_IMAGE_DATA: Remove image data from a meta file that has both image and tracker data, and keep only the tracker data.