GithubHelp home page GithubHelp logo

slicersalt / slicerdwd Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.02 MB

3D Slicer extension for Shape Analysis with DWD (Distance Weighted Discrimination)

License: Apache License 2.0

CMake 8.93% Python 91.07%
3d-slicer-extension shape-analysis

slicerdwd's Introduction

Slicer SALT site template

About

Project is built on top of Jekyll - simple, blog-aware, static site generator. Jekyll also happens to be the engine behind GitHub Pages, which means you can use Jekyll to host your website from GitHub’s servers for free. Learn more about Jekyll.

Local development

Check if you have all requirements for local environment or consider using this docker image.

To install all development dependencies install Bundler.

    gem install bundler

and run next command from root folder:

  bundle install

To start Jekyll run:

    jekyll serve -w

Site will be available at http://127.0.0.1:4000/directory/ or http://localhost:4000/directory/ (on Windows)

NOTE: in this mode all changes to html and data files will be automatically regenerated, but after changing _config.yml you have to restart server.

Sass(Compass) support

Note: You need to install Node.js

To watch changes of .sass files and compile it to the .css on a fly change property safe: true to safe: false in _config.yml. Note: It works only on local machine, because GitHub runs Jekyll in --save mode

Learn more about Sass development from documentation.

Resource optimizations (optional)

You can optimize images and minify css and javascript automatically (for now only on Windows). But for Mac OS users available amazing tool - imageoptim. Thanks @raphaelsavina for link. Optimize all images by running this script from /automation/images/ folder:

    all_image_optimization.bat -d -jtran -pout -pquant -optip -gsicle -svgo

To minify CSS and JS run minify_js.bat (for Windows) and minify_js.sh (for Linux and MacOS) from /automation/minifying/ folder:

    minify_js.bat

Learn more about available optimization options from documentation.

Documentation

Quick-start guide is not enough? Checkout full documentation.

Contributors

See list of contributors

Maintainers: @tasomaniac and @ozasadnyy.

License

Project is published under the MIT license. Feel free to clone and modify repo as you want, but don't forget to add reference to authors :)

slicerdwd's People

Contributors

allemangd avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slicerdwd's Issues

Harden installed `dwd` version

Currently dwd is installed with slicer.util.pip_install when the module is initialized; it would probably be better to package it at build-time with CMake.

SlicerDWD/DWD/DWD.py

Lines 15 to 19 in 875cd9a

try:
import dwd
except ModuleNotFoundError:
slicer.util.pip_install('dwd')
import dwd

Issues installing `cvxpy` dependency.

Since cvxpy requires development tools be installed on the target machine, it is unsuitable for use in SlicerDWD. It's likely possible to build cvxpy in a superbuild for this module, however after spending some time researching this I've found it will be easier to simply use the existing GenDWD classifier as it does not depend on cvxpy.

See related discussion in https://github.com/slicersalt/dwd/issue/1.

To enable this I've integrated slicersalt/dwd#6, which makes cvxpy an optional dependency (installable via pip install dwd[socp]) and disables the DWD conic solver if it is not installed.


Remaining work is to upgrade dwd to 1.0.5 in SlicerDWD, and port to the GenDWD classifier.

Refactor utilities

Currently several functions have been dumped in SlicerDWDLogic that don't really belong.

  • Dataset utilities buildCases, splitCases, make_xy
  • IO utilities read_vtk, save_vtk, copy_dsa
  • Plotting utilities table, scatterPlot, show

SlicerDWDWidget.btnKDEClicked is also very cluttered; much of its behavior should probably be refactored into the same group as the other plotting utilities.

Add module documentation/tutorial

  • Add tooltips for module fields/buttons
  • Describe input formats in documentation/help (csv schema, hyperparameters, etc)
  • Include a sample dataset + tutorial for testing

Change "Distance" units to "standard deviation"

Tweaking the distance units to show as "Standard Deviation (&sigma)" would be more intuitive. While technically the distance is a Euclidean distance in mm, it is in a high-dimensional space so shouldn't really be interpreted as such. Regarding it as statistical significance would probably be more meaningful.

Sort samples by DWD distance

Enable sorting samples by distance to the separating hypeplane as in this mock-up:

mock-up

Since ShapePopulationViewer preserves the order of samples, it should be straightforward to use it to create an initial implementation.

Support train-test-split

Currently all actions (training, analysis) operate on the same dataset. It would be good to implement a way to split training and testing data for more meaningful metrics. Should be able to randomly split a given dataset or manually supply two datasets.

There are already hidden placeholder UI elements, see diff: 875cd9aa

Invoke ShapePopulationViewer to display samples

Once a model has been created, allow samples to be opened in ShapePopulationViewer similar to the "preview" modes of ShapeVariationAnalyzer.

The goal is to see something like:

image

See comments here:

SlicerDWD/DWD/DWD.py

Lines 152 to 175 in 875cd9a

def meanClicked(self):
"""Called when the 'Compute Mean" button is clicked."""
mean = self.logic.meanShape(self.trainCases, factor=50.0)
model = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLModelNode')
model.CreateDefaultDisplayNodes()
model.SetAndObservePolyData(mean.VTKObject)
model.GetDisplayNode().SetVisibility(True)
mgr = slicer.app.layoutManager()
mgr.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView)
## Ideally this would Launch the CLI ShapePopulationViewer
## See SVA for how to invoke SPV.
## https://github.com/NIRALUser/ShapeVariationAnalyzer/blob/master/ShapeVariationAnalyzer/ShapeVariationAnalyzer.py#L742-L764
## Fails with "Could not find logic for module 'ShapePopulationViewer'"
## Can manually select the model in SPV though.
# parameters = {}
# parameters["vtkFiles"] = mean.VTKObject
# module = slicer.modules.shapepopulationviewer
# slicer.cli.run(module, None, parameters, wait_for_completion=True)

And the referenced SVA code.

Ideally the "Distance" scalar would be pre-selected and rendered as vectors, however I don't think that is possible through the SPV CLI.

Allow computing correlations against other datasets

Should be able to import a CSV of numerical data and plot correlations of the DWD Distance against columns in that dataset.

The goal is to see something like:

image

If using the Slicer interactive plots widgets: Selecting a group of samples should allow to view in SPV. See #1.

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.