Shrink-Wrap Imaginar Coefficient Reconstruction Algorithm
Compilation and Installation
To compile this library you need
C++ Compiler (with
c++11support, e.g. GCC 4.7+)
FFTW3 (single precision build)
libSplash (for reading and writing HDF5)
PNGwriter (for storing reconstructed images as PNGs)
The prefix to install the library and additional files (such as headers) into.
If true tests will be run.
If true the examples from the examples directory will be built.
Adds at least debugging symbols to the code.
Build the Doxygen documentation.
Enable PNG output.
Enable HDF5 in- and output.
Create a build directory
mkdir build cd build
For a clean build with debugging information, try
cmake .. -DIMRESH_DEBUG=on -DBUILD_DOC=off
To build and run everything, try
cmake .. -DRUN_TESTS=on -DBUILD_EXAMPLES=on -DUSE_PNG=on -DUSE_SPLASH=on
The usage of imresh is mainly divided into five parts:
where image loading and writing can also be handled outside the library.
The library initialization is (from the user's perspective) just a single call to
imresh::io::taskQueueInit( ). Internally this creates
cudaStream_ts for each multiprocessor on each CUDA capable device found and stores them for later access.
Image loading can be done through imresh's own loading functions (found in
imresh::io::readInFuncs) or with self-written functions.
Your self-written functions have to provide you both the image dimensions and the host memory containing the image. This memory has to be allocated via
newif you're using the built-in write-out functions.
Image processing is just a call to
imresh::io::addTask( )(for explanation of the parameters please have a look at the Doxygen). This will start a thread (a C++
std::threadthread to be precise) handling your data transfers and image processing on the least recently used stream available. The given data write out function will be called inside of this thread, too.
Image writing can, just as the loading, be done via imresh's own write out functions (found in
imresh::io::writeOutFuncs) or with self-written functions. These have to match the following signature:
void writeOutFunc( float* memory, std::pair<unsigned int,unsigned int> size, std::string filename);
memoryis the raw image data,
sizethe image dimension (
size.secondis vertical) and
filenamethe name of the file to store the image in.
If you're using imresh's own loading functions in combination with your own write-out functions be sure you're freeing the image memory with
imresh's workflow is designed in a way that you'd free your memory inside of your write out function. It's never called before the algorithm finishs and therefore the ideal place for freeing the image data. imresh's built-in functions handle it that way.
Library deinitialization is again just a call to
imresh::io::taskQueueDeinit( ). This will handle stream destroying, memory freeing and so on for you.
When you're using your own data reading and/or writing functions, you'll have to handle the memory inside of this functions yourself.
There's a set of in-action examples in the
examples directory. These can be
compiled by appending the
-DBUILD_EXAMPLES=on to your CMake call, e.g.
cmake .. -DBUILD_EXAMPLES=on
For a simple but complete example of how to use this library try
miniExampleand have a look at
For a more complex example with batch processing please have a look at
If you need more example data for your tests, please run
. +-- benchmark: Contains older deprecated less optimized versions for comparison. Files in here should only be used by files in the tests folder +-- cmake: CMake find package scripts +-- examples: Executable examples showing how to use the library | +-- createTestData: Functions for generating example objects and diffraction intensity to test the algorithm on | +-- testData: Static examples with a fixed size to test e.g. `readInFuncs` +-- src: The sources for the actual library. Only this folder is needed with the standard CMake options | +-- imresh | +-- algorithms | +-- io: File input/output and batch processing | +-- libs +-- tests: Unit tests and benchmarks.
Maximilian Knespel (m.knespel at hzdr dot de)
Philipp Trommler (philipp.trommler at tu-dresden dot de)
/usr/include/fftw3.h(373): error: identifier "__float128" is undefined
Update your fftw library or manually apply the patch shown here, i.e. add
|| defined(__CUDACC__)to the faulty line in the header.
stddef.h(432): error: identifier "nullptr" is undefined
Your CMake version is too old.