Home

Awesome

GPUTUM: StructuredEikonal

<img src="https://raw.githubusercontent.com/SCIInstitute/StructuredEikonal/master/src/structuredEikonal.png" align="right" hspace="20" width=450> GPUTUM: StructuredEikonal is a C++/CUDA library written to solve the Eikonal equation on structured meshes. It uses the fast iterative method (FIM) to solve efficiently, and uses GPU hardware.

The code was written by Won-Ki Jeong at the Scientific Computing and Imaging Institute, University of Utah, Salt Lake City, USA. The theory behind this code is published in the papers linked below. Table of Contents

<h4>Aknowledgements</h4> **<a href ="http://people.seas.harvard.edu/~wkjeong/publication/wkjeong-sisc-fim.pdf">A Fast Iterative Method for Eikonal Equations</a>**<br/>

AUTHORS: Won-Ki Jeong(b) <br/> Ross T. Whitaker(a) <br/>

This library solves for the Eikional values for voxels within a volume.

<br/><br/> Requirements

Building

<h3>Linux and OSX</h3> In a terminal: ```c++ mkdir StructuredEikonal/build cd StructuredEikonal/build cmake ../src make ``` <h3>Windows</h3> Open a Visual Studio (32 or 64 bit) Native Tools Command Prompt. Follow these commands: ```c++ mkdir C:\Path\To\StructuredEikonal\build cd C:\Path\To\StructuredEikonal\build cmake -G "NMake Makefiles" ..\src nmake ```

Note: For all platforms, you may need to specify your CUDA toolkit location (especially if you have multiple CUDA versions installed):

cmake -DCUDA_TOOLKIT_ROOT_DIR="~/NVIDIA/CUDA-7.5" ../src

(Assuming this is the location).

Note: If you have compile errors such as <code>undefined reference: atomicAdd</code>, it is likely you need to set your compute capability manually. CMake outputs whether compute capability was determined automatically, or if you need to set it manually. The default minimum compute capability is 2.0.

cmake -DCUDA_COMPUTE_CAPABILITY=20 ../src
make

Running Examples

You will need to enable examples in your build to compile and run them.

cmake -DBUILD_EXAMPLES=ON ../src
make

You will find the example binaries built in your build directory.

Run the examples in the build directory:

./Example1 
-or-
Example1.exe
...

Each example has a <code>--help</code> flag that prints options for that example. <br/>

Follow the example source code in <code>src/example1.cu</code> to learn how to use the library.

Depending on your device architecture, the default volume size may be too large. Make it smaller for Example1 with the option <code>-s 128</code> or a smaller number if necessary. You can try this if you get a CUDA error when running the example.

Using the Library

A basic usage of the library links to the <code>STRUCTURED_EIKONAL</code> library during build and includes the headers needed, which are usually no more than:

#include <StructuredEikonal.h>

Then a program would setup the Eikonal parameters using the <code>StructuredEikonal object</code> object and call <code>object.solveEikonal()</code> to generate the array of voxel values that represent the solution.

Here is a minimal usage example (in 3D).<br/>

#include <StructuredEikonal.h>
#include <iostream>
int main(int argc, char *argv[])
{
  StructuredEikonal data(true);
  //Run the solver
  data.solveEikonal();
  //now use the result
  data.writeNRRD("myfile.nrrd");
}

The following helper functions are available before running the solver:

void StructuredEikonal::setDims(size_t w, size_t h, size_t d);  //set the volume dimensions
void StructuredEikonal::setMapType(size_t t); //pre-generated speed functions (sphere or egg-carton)
void StructuredEikonal::setItersPerBlock(size_t t); //set the iterations per block
void StructuredEikonal::setSpeeds(std::vector<std::vector<std::vector<double> > > speed); //set the voxel speeds
void StructuredEikonal::setSeeds(std::vector<std::array<size_t, 3> > seeds); //set list of seed voxels

The following helper functions are available after running the solver:

void StructuredEikonal::writeNRRD(std::string filename); //write the result as a volume NRRD.
std::vector< std::vector< std::vector<double> > > getFinalResult(); //get the resulting volume voxel values.

You can also access the results and the mesh directly after running the solver:

std::vector<std::vector<std::vector<double> > > StructuredEikonal::answer_;
<h3>Eikonal Options</h3>
  class StructuredEikonalEikonal {
      bool verbose_;                    //option to set for runtime verbosity [Default false]
      size_t itersPerBlock_;            //# of iters / block                  [Default 10]
      size_t width_;														  [Default 256]
      size_t height_;													      [Default 256]
      size_t depth_;													      [Default 256]
      size_t solverType_    ;           //auto speed fuctions,
	                                              0=sphere, 1=eggcarton       [Default 0]
  };
<br/> You will need to make sure your CMake/Makfile/Build setup knows where to point for the library and header files. See the examples and their CMakeLists.txt.<br/><br/>

Testing

Testing has not yet been implemented.