Code Monkey home page Code Monkey logo

aigt's Introduction

SlicerIGT

This repository contains the SlicerIGT extension for 3D Slicer, which provides components for implementing image-guided intervention systems.

User documentation

To learn how to use SlicerIGT, refer to SlicerIGT tutorials.

Modules provided by this extension:

Breach warning

Display distance of tracked tool from an object and give visual and audible warning if the tool gets too close. Helps users to avoid certain regions during surgical resection or other interventions.

Collect points

Record motion trajectory of a tracked tool into markups fiducial list, markups curve, or model node.

Create models

Module for creating simple shapes, such as sphere, cylinder, prism, needle, and coordinate system axes.

Fiducial registration wizard

Register images, models, or any other nodes to each other using manually placed landmark points. Rigid, affine, and warping transforms are supported.

Fiducials to model registration

Automatic registration of model (surface mesh) to markups fiducials (point list) using iterative closest points (ICP) method.

Model registration

Automatic registration of models (surface meshes) using iterative closest points (ICP) method.

Path explorer

Module for specifying tool trajectories by entry and target points and reslice image along and orthogonal to the trajectory line.

Hit E or T key to switch between placement of entry and target point.

Pivot calibration

Determine transformation between tooltip and tracking sensor attached to a tracked tool.

Texture model

Apply texture to a surface model. Useful for displaying models acquired by surface scanners.

Transform processor

This module allows combining, inverting, stabilizing, termporal smoothing of transforms in real-time and writing results into a new output.

Processing modes:

  • Quaternion Average: Compute the quaternion average of all Source transforms provided.
  • Compute Rotation Only: Compute a copy of the rotation from the Source to the Reference.
  • Compute Translation Only: Compute a copy of the translation from the Source to the Reference.
  • Compute Full Transform: Compute a copy of the full transform from the Source to the Reference.
  • Compute Inverse: Compute the inverse of transform to parent, and store it in another node.
  • Compute Shaft Pivot: Compute a constrained version of an Source transform, the translation and z direction are preserved but the other axes resemble the Target coordinate system.
  • Stabilize: Compute a stabilized transform by low-pass filtering. Computation based on the former TrackerStabilizer extension.

Stabilize mode

Position tracking systems are useful for tracking surgical tools, robots, patient motion, etc. However, some tracking systems provide noisy (shaky) measurements and it can be useful to reduce random noise by filtering. Filtering can be also useful for converting abrupt position/orientation changes to smooth transitions, for example for moving a virtual camera.

TrackerStabilizer module provides temporal low-pass filtering for any situations requiring stable position/orientation where time delays are tolerable. User can adjust cut-off frequency (i.e., smoothing parameter): the lower the value, the smoother the motion is but it is important to note that the delay is also increased.

The GUI of the TrackerStabilizer module contains 4 elements:

  • Input Transform: This is the raw data, usually raw tracker data, represented by a vtkMRMLLinearTransformNode
  • Output Transform: This is the filtered transform represented also by a vtkMRMLLinearTransformNode. This node can be created directly from the list
  • Filter checkbox: This checkbox turn on/off the filtering
  • Smoothing slider: This slider control the smoothing parameter. In the left, smoother, with relatively important delay. In the right, faster (almost no delay), but noisier.

Ultrasound snapshots

Module for taking a snapshot of a position tracked ultrasound image and display it as a model node.

Viewpoint

Control 3D view camera using tracked tools and objects. It can either simulate a camera mounted on a tool or can continuously update camera position to keep a selected node in the center of the view.

Volume reslice driver

Move slice view (e.g., to show slice of an image) driven by position and orientation of a tracked tool (or any linear transform), or ROI or line markup.

Watchdog

Displays warning if selected transforms are not continuously updated. It is useful for detecting tracking errors, such as occluded marker or network connection error.

Developer documentation

Basic information for developers is available here.

Software release process

SlicerIGT packages are generated automatically every night from latest code version on master branch and a branch matching the name of the latest Slicer stable branch (e.g., master-48). Exact content can be determined from git hash included in the relase package name and content of SlicerIGT repository.

Nightly test results are available on Slicer dashboard: stable, nightly

Acknowledgements

This work was partially funded by Cancer Care Ontario and the Ontario Consortium for Adaptive Interventions in Radiation Oncology (OCAIRO), and by National Institute of Health (grants 5P01CA067165, 5R01CA124377, 5R01CA138586, 2R44DE019322, 7R01CA124377, 5R42CA137886, 8P41EB015898).

aigt's People

Contributors

bennetmontgomery avatar chriscyyeung avatar gracepigeau avatar hastingsgreer avatar jcfr avatar jlaframboise avatar keiranbarr avatar khashtrudi avatar lassoan avatar markasselin avatar nkitner avatar oliviaodriscoll avatar pdc878 avatar rebeccahisey avatar robertzsoltszabo avatar sunderlandkyl avatar ungi avatar vctoriawu avatar zacbaum avatar zoeyiyi11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aigt's Issues

Update repo description

The repo description of: "Module to export ultrasound annotations for machine learning" isn't a great fit anymore. It would be nice to update to something more relevant such as the first sentence in Readme.md. -- Requires admin privileges to change

Add Sequence Segmentation module to Sequence extension

Idea from an earlier issue: #3

Probably for this it would be good to have a Sequence Segmentation module, which would help setting up segmentation sequence (synchronized with the input image sequence) and some tools to help with propagating segmentation between time points (e.g., using intensity based registration). This module could also have an export feature to save both input image sequence and corresponding segmentation.
This module should be probably in the Sequences extension.

However, in ultrasound sequences, we typically don't segment every item in the input sequence. We skip 5-10 frames between ones that we invest time in segmenting. The number of skipped frames varies within one sequence. When the ultrasound is not moving, we may skip a lot more frames.

Issue with Running prepare_data.py Script

I'm currently facing an issue while running the prepare_data.py script, and I could use your expertise to resolve it.

Here's a brief overview of the problem:

I exported my segmentations from 3DSlicer in the form of two files: "_segmentation.py" and "_ultrasound.py." I've placed these two files in a folder named "SegmentationOutput" and attempted to execute the following command in my terminal:

python prepare_data.py --input_dir SegmentationOutput --output_dir PatientArrays --config_file prepare_data_config.yaml --log_file "PrepareData.log"

My problem arises from the creation of the "_indices.py" file. As per my understanding of the prepare_data.py script, the "_indices.py" file should be derived from the "_segmentation.npy" file. However, the line in the script that reads seg_filename.replace("_segmentation", "_indices") seems to only change the string that describes the path to the folder, but it does not actually create the "_indices.py" file. Even if it did, just renaming "_segmentation.py" to "_indices.py" wouldn't work because the dimensions don't match. Ideally, the "_indices.py" file should have only one dimension, but it appears to be 3D when derived from "_segmentation.py."

I would greatly appreciate your assistance in understanding how to obtain the correct "_indices.py" file or any insights on how to resolve this issue.

Thank you in advance for your support.

Customize SegmentationUNet.py

Hi, I am trying to run Live US Segmentation in Slicer and have customized the loading and preprocessing of the input/output image to my training net. However, the SegmentationUNet extension is no longer visible in the Slicer modules. I am using a FlexibleUNet and Pytorch (Monai Template). How can I adapt the SegmentationUNet.py so that it is available in Slicer?

Add option to shuffle training data

The current dataset is great for saving memory. But using it with shuffle option is extremely slow.
Shuffling datasets would be important. The way it is now, we only use data from one patient in one batch. This makes every training step biased towards one patient. Even worse, one batch of data only contains one part of the anatomy, because they are all consecutive ultrasound images.

The fastest and most memory efficient for training would be to implement suffling in the prepare_data script. It would take slower to prepare the shuffled data, but then it could be used many times. It's not ideal in the sense that the same batches would be used in every epoch. But at least the represent a broader range of data.

Another option would be to load a set of data arrays (patients) at a time, and adding shuffling among those while in memory. The number of arrays loaded could be a parameter in the dataset class. This would create different batches in every epoch.

Where is the "Processes" modules?

Hi,

Thank you for developing such a wonderful software!

Inspired by a very interesting YouTube video about Spine Ultrasound Segmentation, I wanted to test with the same data as the video, but I'm suffering from errors.

I get an error with from Processes import Process, ProcessesLogic in
SlicerExtension/LiveUltrasoundAi/SegmentationUNet/SegmentationUNet.py.

Where can I get this "Processes" module?

Dataset availability

Hi,

Is the dataset used to train the US bone segmentation networks publicly available?

If so, could you please provide me with a link?

Thanks!

train.py stopped logging into file and prints log in terminal

This coincides in time with the code starting to use monai. I'm not sure if the two are related. Even though the config-file argument is given and logging.basicConfig is called with the correct file name, the log output still goes to the terminal and not in the file. It would be good to debug this, because log files are best preserved in the same folder together with trained models. So we have a good record of how the model was trained.

Better control for selecting training/validation data

It should be easier to add/remove data to/from validation rounds. It should also be possible to specify validation data without leave-one-out, or no validation at all (when want to maximize training data before testing).

Support images multiple segments

We need to start supporting multiple segments by one-hot encoding, multi-channel model outputs, and softmax instead of sigmoid final activation. Robert tried this on his dataset by modifying our code, and he says it was quite simple to do.

I think Single Slice Segmentation exports different segments as different values, so that may need to be converted to one-hot encoding later by one of the scripts. The safest place to do this would be in the training script. But we may need to modify the prepare_data script too. Multi-value segmentation arrays should only be resized using nearest neighbor interpolation. Standard image resize functions can interpolate between values (if a new pixel position falls between two old pixel positions). But interpolated non-integer values cannot be later converted using one-hot encoding.

Record performance metrics of each trained model

  • Implement timing of final model in train scrip
  • Implement timing in the Slicer sequence segmentation module.

We should keep in mind that most of our models will be deployed in real time. A typical ultrasound machine produces 15-25 frames/second. At the end of training script, we should add a loop that feeds a batch of (or e.g. 100) image frames to the trained model and computes the prediction (inference mode, no augmentation). We should time this and save the average, min, max times /frame.

The goal is around 20 ms inference time, to leave time in the user application for resizing images and do some UI rendering after each frame. We can save trained models with higher inference time for experimentation. But if we see much higher numbers, that should tell us to look at smaller models.

Additionally, we should check time/frame when using the trained model in Slicer, so we have an idea how much overhead it takes to also render images at the same time.

Dataset __getitem__ cannot return None

None was being returned from the __getitem__ method of the UltrasoundDataset in the case where transform arrays were not provided, causing Pytorch to raise an error. This issue was temporarily fixed in 1a4c1dd by removing None from the method return, but there is probably a better way to handle this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.