Skip to content

Commit

Permalink
removed unnecessary const attribute in sink
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Mar 20, 2014
1 parent 89da0e3 commit cfc0781
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 42 deletions.
5 changes: 4 additions & 1 deletion blockedarray/adapters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

import vigra

import numpy as np
from _blockedarray import Source3U8 as _Source
from _blockedarray import Sink3 as _Sink
Expand Down Expand Up @@ -117,7 +119,8 @@ def __init__(self):
def pyWriteBlock(self, roi, block):
assert len(roi) == 2
if self.vol is None:
shape = _v2tup(self.shape)
shape = self.shape
shape = _v2tup(shape)
self.vol = np.zeros(shape, dtype=np.uint8)
s = _roi2slice(roi[0], roi[1])
self.vol[s] = block
Expand Down
6 changes: 3 additions & 3 deletions blockedarray/adapters_py.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ void exposeSink(const char* exposedName) {

class_<PySinkABC<N,T>, boost::noncopyable>(exposedName)
.def("pyWriteBlock", pure_virtual(&PySinkABC<N,T>::pyWriteBlock))
.add_property("shape", &PySinkABC<N,T>::getShape, &PySinkABC<N,T>::setShape)
.add_property("blockShape", &PySinkABC<N,T>::getBlockShape, &PySinkABC<N,T>::setBlockShape)
//.add_property("shape", &PySinkABC<N,T>::getShape, &PySinkABC<N,T>::setShape)
//.add_property("blockShape", &PySinkABC<N,T>::getBlockShape, &PySinkABC<N,T>::setBlockShape)
;
}

void export_adapters() {
exposeSource<3,vigra::UInt8>("Source3U8");
exposeSink<3,ConnectedComponents<3>::LabelType>("Sink3");
registerConverters();
// registerConverters();
}
47 changes: 11 additions & 36 deletions blockedarray/blockwisecc_py.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,6 @@

using namespace BW;

template<int N>
struct PyConnectedComponents {
typedef ConnectedComponents<N> BCC;
};

template<int N, class V>
struct ExportV {
static void export_();
};

template<class V>
struct ExportV<2, V> {
static void export_() {
using namespace boost::python;
class_<V>("V", init<int, int>());
}
};


template<class V>
struct ExportV<3, V> {
static void export_() {
using namespace boost::python;
class_<V>("V", init<int, int, int>());
}
};

template<class V>
struct ExportV<4, V> {
static void export_() {
using namespace boost::python;
class_<V>("V", init<int, int, int, int>());
}
};


template <int N, class T>
void exportSpecificSource(std::string suffix)
{
Expand All @@ -110,6 +74,7 @@ void exportSourceForDim()
exportSpecificSource<N,double>("D");
}


template <int N>
void exportAllForDim()
{
Expand All @@ -132,6 +97,7 @@ void exportAllForDim()
exportSourceForDim<N>();


// connected components class
typedef ConnectedComponents<N> BCC;
class_<BCC>("ConnectedComponents",
init<Source<N, vigra::UInt8>*, typename BCC::V>())
Expand All @@ -141,6 +107,15 @@ void exportAllForDim()
(arg("sink")))
;


// ROI
typedef typename Roi<N>::V V;

class_< Roi<N> >("Roi", init<V,V>())
.def_readonly("p", &Roi<N>::p)
.def_readonly("q", &Roi<N>::p)
;

}


Expand Down
4 changes: 2 additions & 2 deletions include/bw/sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class Sink {
blockShape_ = shape;
}

V shape() const { return shape_; };
V blockShape() const { return blockShape_; };
V shape() { return shape_; };
V blockShape() { return blockShape_; };

virtual bool writeBlock(Roi<N> roi, const vigra::MultiArrayView<N,T>& block) { return true; };

Expand Down

0 comments on commit cfc0781

Please sign in to comment.