GithubHelp home page GithubHelp logo

eigenvivek / diffdrr Goto Github PK

View Code? Open in Web Editor NEW
101.0 4.0 9.0 2.61 GB

Auto-differentiable digitally reconstructed radiographs in PyTorch

Home Page: https://vivekg.dev/DiffDRR

License: MIT License

Python 99.47% CSS 0.53%
medical-imaging raytracing digitally-reconstructed-radiograph 2d-3d-registration differentiable-rendering

diffdrr's People

Contributors

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

diffdrr's Issues

Fix GIF framerate

It looks very nice in notebook, but the framerate is much too high when saved to disk

Camera-ready submission TODOs

My comments

  • Xray-to-CT is not an example of slice-to-volume registration. An Xray is not a tomographic slice of the volume; it is a projection. Change to 2D-to-3D registration or Xray-to-CT registration.
  • Rewrite convergence experiment to use momentum.
  • Remake convergence figure.
  • Add acknowledgements (email polina to ask what grants to add)

Reviewer 1

  • Try comparison to Plastimatch GPU (I swear it wasn't working at time of writing).

Reviewer 2

  • Understand correlation between failure to converge and initialization parameters
  • Maybe show comparison to gradient-free optimization?
  • Better explain how using differentiable DRRs can get you to real-time speed (especially with pretraining, reference voxelmorph -- we are pluggable in deep learning framework including for registration and reconstruction)
  • Try bigger volumes

Reviewer 3

  • 2nd para of the introduction has mixed multiple topics

Multiresolution DRRs

Instead of multiresolution rays, use a multiresolution voxel grid (ie, octree represent the CT)

Get the initialization neural network working

Nalini's advice:

  1. Check the training loss
  2. Make sure the network can learn a single example
  3. Use batchnorm
  4. Use residual connections
  5. Try a deeper network
  6. Try to predict just a few parameters (eg, just project through an axis-aligned slice)

Make subsampling stochastic

Currently, the random subsample of pixels is initialized with the DRR generator. Instead, the random sample should be generated every time the forward model is called. This ensures that the entire image can be sampled over the course of an optimization run, instead just a fixed subset.

Fix finite differences

generate two DRRs
sum sq diff as loss func

params, perturb by a vector (randomly generated)
then compute the finite difference

two gradients (auto and finite)
compute difference
compute length of difference

scatterplot
x : length of gradient (for finite differences)
y : length of difference

might want to do this for every parameter separately because they have different scales

Update API in old notebooks

A few notebooks were never updated to the new API and it's confusing for first-time users. Need to fix any breaking changes in the notebooks.

Enable computation of sparse DRRs

Want to be able to compute just a subset of the pixels

also would be helpful to have sparse implementations of loss functions too!

Add tests

  • Figure out a testing package
  • Add tests to make sure core API is never broken

Time optimization

  • Nelder-Mead vs gradient-based descent
  • Try training a NN to predict DRR parameters
  • Make optimization timing plot

Switch to einsum notation

Use einsum notation to do all the tensor computations in DRR generation

This notation make the computation of batched DRRs much easier as well (#30)

Enable batch computation of DRRs

Extend the API to allow multiple set of parameters be passed simultaneously

Also check that XCorr2 will work with batches in current form

Loss metrics

  • Implement all loss metrics (L2, NCC)
  • Try to make a 3D plot for the loss landscape?

Unstructure the forward model code

The 3D volume and the 2D detector plane are stored as their physical analogs (3D voxelgrid and 4D tensor of spatial coordinates, respectively). This is helpful for conceptualization, but there is no need to structure the code based on the geometry of the real world.

  • The voxelgrid could be completely flattened, or hashed, so long as it's any structure with lookup.
  • The spatial coordinates should be reshaped from (b, n1, n2, 3) where n1,n2 are image dimensions to (b, m, 3) where m=n1xn2. This would be especially useful for getting sparse computation of DRRs working (#22).

Dynamically delete tensors during DRR generation

Once a large tensor like alpha, alphamids or step_length is no longer necessary, it should be deleted to free up memory on the GPU

This would also potentially allow us to overcome memory issues for large DRRs

Add a learning example

Given an input DRR from unknown parameters, train a NN to predict the parameters (ie, an pre-initialization network)

  • Generate multiple (parameter, DRR) pairs and train NN

Start w/ the architecture in Fig 4 from alansary et al

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.