Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blockwise and Chunked python bindings #373

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Blockwise and Chunked python bindings #373

wants to merge 15 commits into from

Conversation

kkiefer
Copy link
Contributor

@kkiefer kkiefer commented Jun 8, 2016

The module vigra.blockwise module now contains the following functions, all of which are executed in parrallel. For all functions the out parameter is optional unless your source is a hdf5 chunked array, in this case the user is required to specify the out parameter because we can not provide reasonable default names for the associate file and dataset name. If not specify the out parameter will have the same array type / chunked array backend as source.
Unlike the c++ backend, we do not have a way to construct a chunked array containing tinyvector data
on python side as of right now. This implies that one may only call functions on chunked arrays where source as well as out are chunked arrays containing scalar data. In particular this means one can not compute hessianOfGaussianEigenvalues on chunked arrays on python side but calling hessianOfGaussianFirstEigenvalues is perfectly fine because we only need chunked arrays with tinyvector data internally.

  1. gaussianSmooth(source, convOptions, out) [CHUNKED ARRAY SUPPORTED]
  2. gaussianGradientMagnitude(source, convOptions, out) [CHUNKED ARRAY SUPPORTED]
  3. gaussianDivergence(source, convOptions, out)
  4. gaussianGradient(source, convOptions, out)
  5. laplacianOfGaussian(source, convOptions, out)
  6. hessianOfGaussian(source, convOptions, out)
  7. hessianOfGaussianEigenvalues(source, convOptions, out)
  8. hessianOfGaussianFirstEigenvalue(source, convOptions, out) [CHUNKED ARRAY SUPPORTED]
  9. hessianOfGaussianLastEigenvalue(source, convOptions, out) [CHUNKED ARRAY SUPPORTED]
  10. symmetricGradient(source, convOptions, out)
  11. structureTensor(source, convOptions, out)
  12. unionFindWatersheds(source, labelOptions, out) [CHUNKED ARRAY SUPPORTED]
  13. labelArray(source, labelOptions, out) [CHUNKED ARRAY SUPPORTED]

Function 1) to 11) return the out paramter.
Function 12) and 13) return a tuple (maxLabel, out).

We support the following datatypes:
Function 1) to 11) -> source.dtype = numpy.float32 out.dtype = numpy.float32
Function 12) and 13) -> source.dtype = numpy.uint8 | uint32 | float32 out.dtype = numpy.float32
Adding additional datatypes is easy to do, please feel free to make an issue or write an e-mail in case u need them.

The option classes [design is not finalized]:
Both option class live in the module vigra.blockwise.

  1. BlockwiseLabelOptions.
    -) default constructor
    -) property: blockshape
    -) property: numThreads
    -) property: backgroundValue
    -) property: neighborhood (either "direct" or "indirect")
    -) function: hasBackgroundValue() [returns bool]
    freestanding factory:
    labelOptions(blockshape, neighborhood="direct", backgroundValue=None, numThreads=cpuCount())

  2. BlockwiseConvolutionOptionsXD. [X element of {1,2,3,4,5}]
    -) default constructor
    -) property: stdDev
    -) property: innerScale
    -) property: outerScale
    -) property: blockshape
    -) property: numThreads
    freestanding factory:
    convolutionOptions(blockshape, sigma=None, innerScale=None, outerScale=None, numThreads=cpuCount()) [X = len(blockshape)]

kkiefer added 14 commits March 31, 2016 11:52
new file:   multi_chunked.hxx
new file:   ../../test/chunkedconvolution/CMakeLists.txt
new file:   ../../test/chunkedconvolution/test_chunked_convolution.cxx
new file:   ../../test/chunkedconvolution/utils.hxx

modified:   multi_array_chunked.hxx
modified:   ../../test/CMakeLists.txt

** in file multi_chunked.hxx **
The following functions have been overloaded:
    gaussianSmoothMultiArray
    gaussianGradientMultiArray
    gaussianDivergenceMultiArray
    gaussianGradientMagnitudeMultiArray
    hessianOfGaussianMultiArray
    hessianOfGaussianEigenvaluesMultiArray
    hessianOfGaussianFirstEigenvalueMultiArray
    hessianOfGaussianLastEigenvalueMultiArray
    laplacianOfGaussianMultiArray
    symmetricGradientMultiArray
    structureTensorMultiArray

** in file multi_array_chunked.hxx **
Added the "function":
    CompareChunkedArray

** in folder test **
Added test for the overloaded functions in multi_chunked.hxx
@ukoethe
Copy link
Owner

ukoethe commented Jun 11, 2016

I cleaned up the commit history and created a new PR #378. Please continue the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants