diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h index e8adf981b7be38e939e732bf930a612495c0d8b9..55b674e867f91cf27fe2ac24b7195e3d6a2333c3 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h @@ -65,12 +65,12 @@ public: _offsetY = offset; } /// set the field name used for X - void setFieldNameX(const std::string& name) { - _xId = name; + void setFieldNameX(const std::string& fieldName) { + _xId = fieldName; } /// set the field name used for Y - void setFieldNameY(const std::string& name) { - _yId = name; + void setFieldNameY(const std::string& fieldName) { + _yId = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h index 2365dd4ec22e5f2c3266228e56613fb1f788bedb..d13cb09b9fffa324f059781ae029aa04386d7ced 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h @@ -45,8 +45,8 @@ public: _offsetZ = offset; } /// set the field name used for Z - void setFieldNameZ(const std::string& name) { - _zId = name; + void setFieldNameZ(const std::string& fieldName) { + _zId = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h index d0febe4e59004873b194cf926fd1350d93989414..583d55ed0b40bd6850b5661391517cbc1250bfa8 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h @@ -65,12 +65,12 @@ public: _offsetZ = offset; } /// set the field name used for X - void setFieldNameX(const std::string& name) { - _xId = name; + void setFieldNameX(const std::string& fieldName) { + _xId = fieldName; } /// set the field name used for Y - void setFieldNameZ(const std::string& name) { - _zId = name; + void setFieldNameZ(const std::string& fieldName) { + _zId = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h index 37479f1574df05b05212e2d88b1e4db39f2cd6f4..322291f41aae5c7254a54e7f706b15ff75ffa2ec 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h @@ -67,12 +67,12 @@ public: _offsetZ = offset; } /// set the field name used for Y - void setFieldNameY(const std::string& name) { - _yId = name; + void setFieldNameY(const std::string& fieldName) { + _yId = fieldName; } /// set the field name used for Z - void setFieldNameZ(const std::string& name) { - _zId = name; + void setFieldNameZ(const std::string& fieldName) { + _zId = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h index 311c978f704642495aa1b3a8c91e84111868a8a1..46d2d698ed0d7bfd77d94a9426f9f21cc50be21e 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h @@ -66,12 +66,12 @@ public: _offsetPhi = offset; } /// set the field name used for X - void setFieldNameR(const std::string& name) { - _rId = name; + void setFieldNameR(const std::string& fieldName) { + _rId = fieldName; } /// set the field name used for Y - void setFieldNamePhi(const std::string& name) { - _phiId = name; + void setFieldNamePhi(const std::string& fieldName) { + _phiId = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h index 7721ae1743a7f32eb09860503bcd035f7ac1d84e..c504915cf4e18a69e0fb82e34cd1ef178ff82e40 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h @@ -51,12 +51,12 @@ public: return _phiId; } /// set the grid Boundaries in R - void setGridRValues(double cellSize, int position) { - _gridRValues[position] = cellSize; + void setGridRValues(double cellSize, int rID) { + _gridRValues[rID] = cellSize; } /// set the grid size in Phi - void setGridSizePhi(double cellSize, int position) { - _gridPhiValues[position] = cellSize; + void setGridSizePhi(double cellSize, int phiID) { + _gridPhiValues[phiID] = cellSize; } /// set the grid boundaries for R @@ -78,12 +78,12 @@ public: _offsetPhi = offset; } /// set the field name used for X - void setFieldNameR(const std::string& name) { - _rId = name; + void setFieldNameR(const std::string& fieldName) { + _rId = fieldName; } /// set the field name used for Y - void setFieldNamePhi(const std::string& name) { - _phiId = name; + void setFieldNamePhi(const std::string& fieldName) { + _phiId = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h b/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h index 56e5447efb3b2bc3311e27f4af913e791d3ea5ac..260dde65812b490e0ed600bd865c0248d9497feb 100644 --- a/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h +++ b/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h @@ -69,12 +69,12 @@ public: _offsetPhi = offset; } /// set the field name used for theta - void setFieldNameTheta(const std::string& name) { - _thetaID = name; + void setFieldNameTheta(const std::string& fieldName) { + _thetaID = fieldName; } /// set the field name used for phi - void setFieldNamePhi(const std::string& name) { - _phiID = name; + void setFieldNamePhi(const std::string& fieldName) { + _phiID = fieldName; } protected: diff --git a/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h b/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h index 94aed501b04ac7775d291ba218cd1a5710b26d21..9b6f9b0afa913a429efad31e9f602007dc815b81 100644 --- a/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h @@ -21,8 +21,8 @@ class TiledLayerSegmentation: public Segmentation { public: /// Helper class to store x and y dimensions of a layer struct LayerDimensions { - LayerDimensions(double x = 1., double y = 1.) : - x(x), y(y) {} + LayerDimensions(double _x = 1., double _y = 1.) : + x(_x), y(_y) {} double x, y; }; @@ -77,16 +77,16 @@ public: } /// set the encoding field name used for X - void setIdentifierX(const std::string& name) { - _identifierX = name; + void setIdentifierX(const std::string& fieldName) { + _identifierX = fieldName; } /// set the encoding field name used for Y - void setIdentifierY(const std::string& name) { - _identifierY = name; + void setIdentifierY(const std::string& fieldName) { + _identifierY = fieldName; } /// set the encoding field name used for layer - void setIdentifierLayer(const std::string& name) { - _identifierLayer = name; + void setIdentifierLayer(const std::string& fieldName) { + _identifierLayer = fieldName; } /// set the dimensions of the given layer diff --git a/DDSegmentation/src/BitField64.cpp b/DDSegmentation/src/BitField64.cpp index 1deac192d1e09333caf91a02d513cdbbd12f4776..47e744dab39848d2adc0f6d3589d6f3a5dfc8f2f 100644 --- a/DDSegmentation/src/BitField64.cpp +++ b/DDSegmentation/src/BitField64.cpp @@ -8,28 +8,28 @@ namespace DD4hep{ namespace DDSegmentation { - BitFieldValue::BitFieldValue( long64& bitfield, const std::string& name, - unsigned offset, int signedWidth ) : + BitFieldValue::BitFieldValue( long64& bitfield, const std::string& fieldName, + unsigned fieldOffset, int signedWidth ) : _b(bitfield), _mask(0), - _name( name ), - _offset( offset ), + _name( fieldName ), + _offset( fieldOffset ), _width( abs( signedWidth ) ), _minVal(0), _maxVal(0), _isSigned( signedWidth < 0 ) { // sanity check - if( offset > 63 || offset+_width > 64 ) { + if( _offset > 63 || _offset+_width > 64 ) { std::stringstream s ; s << " BitFieldValue '" << _name << "': out of range - offset : " - << offset << " width " << _width ; + << _offset << " width " << _width ; throw( std::runtime_error( s.str() ) ) ; } - _mask = ( ( 0x0001LL << _width ) - 1 ) << offset ; + _mask = ( ( 0x0001LL << _width ) - 1 ) << _offset ; // compute extreme values for later checks diff --git a/DDSegmentation/src/CartesianGridXY.cpp b/DDSegmentation/src/CartesianGridXY.cpp index c079be45e4afe862eb7687a814d9b518769c0c82..4c9e8867cf3384804b440bfeee88f54617d459ba 100644 --- a/DDSegmentation/src/CartesianGridXY.cpp +++ b/DDSegmentation/src/CartesianGridXY.cpp @@ -34,17 +34,17 @@ CartesianGridXY::~CartesianGridXY() { } /// determine the position based on the cell ID -Vector3D CartesianGridXY::position(const CellID& cellID) const { - _decoder->setValue(cellID); - Vector3D position; - position.X = binToPosition((*_decoder)[_xId].value(), _gridSizeX, _offsetX); - position.Y = binToPosition((*_decoder)[_yId].value(), _gridSizeY, _offsetY); - return position; +Vector3D CartesianGridXY::position(const CellID& cID) const { + _decoder->setValue(cID); + Vector3D cellPosition; + cellPosition.X = binToPosition((*_decoder)[_xId].value(), _gridSizeX, _offsetX); + cellPosition.Y = binToPosition((*_decoder)[_yId].value(), _gridSizeY, _offsetY); + return cellPosition; } /// determine the cell ID based on the position - CellID CartesianGridXY::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + CellID CartesianGridXY::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& vID) const { + _decoder->setValue(vID); (*_decoder)[_xId] = positionToBin(localPosition.X, _gridSizeX, _offsetX); (*_decoder)[_yId] = positionToBin(localPosition.Y, _gridSizeY, _offsetY); return _decoder->getValue(); diff --git a/DDSegmentation/src/CartesianGridXYZ.cpp b/DDSegmentation/src/CartesianGridXYZ.cpp index 716cc14a4fd26fb90e553fcbda29a962dcd7edb6..5d4b62e54c7145bbbc0e4726cc07de898ba1ef49 100644 --- a/DDSegmentation/src/CartesianGridXYZ.cpp +++ b/DDSegmentation/src/CartesianGridXYZ.cpp @@ -31,18 +31,18 @@ CartesianGridXYZ::~CartesianGridXYZ() { } /// determine the position based on the cell ID -Vector3D CartesianGridXYZ::position(const CellID& cellID) const { - _decoder->setValue(cellID); - Vector3D position; - position.X = binToPosition((*_decoder)[_xId].value(), _gridSizeX, _offsetX); - position.Y = binToPosition((*_decoder)[_yId].value(), _gridSizeY, _offsetY); - position.Z = binToPosition((*_decoder)[_zId].value(), _gridSizeZ, _offsetZ); - return position; +Vector3D CartesianGridXYZ::position(const CellID& cID) const { + _decoder->setValue(cID); + Vector3D cellPosition; + cellPosition.X = binToPosition((*_decoder)[_xId].value(), _gridSizeX, _offsetX); + cellPosition.Y = binToPosition((*_decoder)[_yId].value(), _gridSizeY, _offsetY); + cellPosition.Z = binToPosition((*_decoder)[_zId].value(), _gridSizeZ, _offsetZ); + return cellPosition; } /// determine the cell ID based on the position - CellID CartesianGridXYZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + CellID CartesianGridXYZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& vID) const { + _decoder->setValue(vID); (*_decoder)[_xId] = positionToBin(localPosition.X, _gridSizeX, _offsetX); (*_decoder)[_yId] = positionToBin(localPosition.Y, _gridSizeY, _offsetY); (*_decoder)[_zId] = positionToBin(localPosition.Z, _gridSizeZ, _offsetZ); diff --git a/DDSegmentation/src/CartesianGridXZ.cpp b/DDSegmentation/src/CartesianGridXZ.cpp index a2490733f736076b172cd2172bf506891203a781..5a4043ad30927cf2fb0af782bc33cc60d2251f77 100644 --- a/DDSegmentation/src/CartesianGridXZ.cpp +++ b/DDSegmentation/src/CartesianGridXZ.cpp @@ -36,18 +36,18 @@ CartesianGridXZ::~CartesianGridXZ() { } /// determine the position based on the cell ID -Vector3D CartesianGridXZ::position(const CellID& cellID) const { - _decoder->setValue(cellID); +Vector3D CartesianGridXZ::position(const CellID& cID) const { + _decoder->setValue(cID); vector<double> localPosition(3); - Vector3D position; - position.X = binToPosition((*_decoder)[_xId].value(), _gridSizeX, _offsetX); - position.Z = binToPosition((*_decoder)[_zId].value(), _gridSizeZ, _offsetZ); - return position; + Vector3D cellPosition; + cellPosition.X = binToPosition((*_decoder)[_xId].value(), _gridSizeX, _offsetX); + cellPosition.Z = binToPosition((*_decoder)[_zId].value(), _gridSizeZ, _offsetZ); + return cellPosition; } /// determine the cell ID based on the position - CellID CartesianGridXZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + CellID CartesianGridXZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& vID) const { + _decoder->setValue(vID); (*_decoder)[_xId] = positionToBin(localPosition.X, _gridSizeX, _offsetX); (*_decoder)[_zId] = positionToBin(localPosition.Z, _gridSizeZ, _offsetZ); return _decoder->getValue(); diff --git a/DDSegmentation/src/CartesianGridYZ.cpp b/DDSegmentation/src/CartesianGridYZ.cpp index 52395855f74132342efb090d7ddaabd5e93105d7..42515bd3e1a98fcb3b9922c7cda883c293a8f76d 100644 --- a/DDSegmentation/src/CartesianGridYZ.cpp +++ b/DDSegmentation/src/CartesianGridYZ.cpp @@ -35,17 +35,17 @@ CartesianGridYZ::~CartesianGridYZ() { } /// determine the position based on the cell ID -Vector3D CartesianGridYZ::position(const CellID& cellID) const { - _decoder->setValue(cellID); - Vector3D position; - position.Y = binToPosition((*_decoder)[_yId].value(), _gridSizeY, _offsetY); - position.Z = binToPosition((*_decoder)[_zId].value(), _gridSizeZ, _offsetZ); - return position; +Vector3D CartesianGridYZ::position(const CellID& cID) const { + _decoder->setValue(cID); + Vector3D cellPosition; + cellPosition.Y = binToPosition((*_decoder)[_yId].value(), _gridSizeY, _offsetY); + cellPosition.Z = binToPosition((*_decoder)[_zId].value(), _gridSizeZ, _offsetZ); + return cellPosition; } /// determine the cell ID based on the position - CellID CartesianGridYZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + CellID CartesianGridYZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& vID) const { + _decoder->setValue(vID); (*_decoder)[_yId] = positionToBin(localPosition.Y, _gridSizeY, _offsetY); (*_decoder)[_zId] = positionToBin(localPosition.Z, _gridSizeZ, _offsetZ); return _decoder->getValue(); diff --git a/DDSegmentation/src/PolarGridRPhi.cpp b/DDSegmentation/src/PolarGridRPhi.cpp index ee04360221b52037febea7d040f59824d73131c3..dbf0bcf9cbdc469f03b9ed93246a08f59528ea4d 100644 --- a/DDSegmentation/src/PolarGridRPhi.cpp +++ b/DDSegmentation/src/PolarGridRPhi.cpp @@ -34,21 +34,21 @@ PolarGridRPhi::~PolarGridRPhi() { } /// determine the position based on the cell ID -Vector3D PolarGridRPhi::position(const CellID& cellID) const { - _decoder->setValue(cellID); - Vector3D position; +Vector3D PolarGridRPhi::position(const CellID& cID) const { + _decoder->setValue(cID); + Vector3D cellPosition; double R = binToPosition((*_decoder)[_rId].value(), _gridSizeR, _offsetR); double phi = binToPosition((*_decoder)[_phiId].value(), _gridSizePhi, _offsetPhi); - position.X = R * cos(phi); - position.Y = R * sin(phi); + cellPosition.X = R * cos(phi); + cellPosition.Y = R * sin(phi); - return position; + return cellPosition; } /// determine the cell ID based on the position - CellID PolarGridRPhi::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + CellID PolarGridRPhi::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& vID) const { + _decoder->setValue(vID); double phi = atan2(localPosition.Y,localPosition.X); double R = sqrt( localPosition.X * localPosition.X + localPosition.Y * localPosition.Y ); diff --git a/DDSegmentation/src/PolarGridRPhi2.cpp b/DDSegmentation/src/PolarGridRPhi2.cpp index b82c05bd45e4a041bd727563a4aa40d3885e60e9..dc6282a6ef1adb2668b43088f600ca0c325366d1 100644 --- a/DDSegmentation/src/PolarGridRPhi2.cpp +++ b/DDSegmentation/src/PolarGridRPhi2.cpp @@ -32,9 +32,9 @@ PolarGridRPhi2::~PolarGridRPhi2() { } /// determine the position based on the cell ID -Vector3D PolarGridRPhi2::position(const CellID& cellID) const { - _decoder->setValue(cellID); - Vector3D position; +Vector3D PolarGridRPhi2::position(const CellID& cID) const { + _decoder->setValue(cID); + Vector3D cellPosition; const int rBin = (*_decoder)[_rId].value(); double R = binToPosition(rBin, _gridRValues, _offsetR); double phi = binToPosition((*_decoder)[_phiId].value(), _gridPhiValues[rBin], _offsetPhi+_gridPhiValues[rBin]*0.5); @@ -43,15 +43,15 @@ Vector3D PolarGridRPhi2::position(const CellID& cellID) const { phi += 2*M_PI; } - position.X = R * cos(phi); - position.Y = R * sin(phi); + cellPosition.X = R * cos(phi); + cellPosition.Y = R * sin(phi); - return position; + return cellPosition; } /// determine the cell ID based on the position - CellID PolarGridRPhi2::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + CellID PolarGridRPhi2::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& vID) const { + _decoder->setValue(vID); double phi = atan2(localPosition.Y,localPosition.X); double R = sqrt( localPosition.X * localPosition.X + localPosition.Y * localPosition.Y ); diff --git a/DDSegmentation/src/ProjectiveCylinder.cpp b/DDSegmentation/src/ProjectiveCylinder.cpp index 1f2dd38b36343f034fa3448d276713098128db8c..41878e1f153dc73fc3b6cdecc41f8c2696e5a349 100644 --- a/DDSegmentation/src/ProjectiveCylinder.cpp +++ b/DDSegmentation/src/ProjectiveCylinder.cpp @@ -40,17 +40,17 @@ ProjectiveCylinder::~ProjectiveCylinder() { } /// determine the local based on the cell ID -Vector3D ProjectiveCylinder::position(const long64& cellID) const { - return Util::positionFromRThetaPhi(1.0, theta(cellID), phi(cellID)); +Vector3D ProjectiveCylinder::position(const long64& cID) const { + return Util::positionFromRThetaPhi(1.0, theta(cID), phi(cID)); } /// determine the cell ID based on the position - CellID ProjectiveCylinder::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, const VolumeID& volumeID) const { - _decoder->setValue(volumeID); - double theta = thetaFromXYZ(globalPosition); - double phi = phiFromXYZ(globalPosition); - (*_decoder)[_thetaID] = positionToBin(theta, M_PI / (double) _thetaBins, _offsetTheta); - (*_decoder)[_phiID] = positionToBin(phi, 2 * M_PI / (double) _phiBins, _offsetPhi); + CellID ProjectiveCylinder::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, const VolumeID& vID) const { + _decoder->setValue(vID); + double lTheta = thetaFromXYZ(globalPosition); + double lPhi = phiFromXYZ(globalPosition); + (*_decoder)[_thetaID] = positionToBin(lTheta, M_PI / (double) _thetaBins, _offsetTheta); + (*_decoder)[_phiID] = positionToBin(lPhi, 2 * M_PI / (double) _phiBins, _offsetPhi); return _decoder->getValue(); } diff --git a/DDSegmentation/src/Segmentation.cpp b/DDSegmentation/src/Segmentation.cpp index ccd38fb408db7b1eb0e06292db441972647cdf6c..b284acc568d075b654e855ee1e86024948b0c057 100644 --- a/DDSegmentation/src/Segmentation.cpp +++ b/DDSegmentation/src/Segmentation.cpp @@ -31,8 +31,8 @@ Segmentation::Segmentation(const string& cellEncoding) : } /// Default constructor used by derived classes passing an existing decoder -Segmentation::Segmentation(BitField64* decoder) : - _name("Segmentation"), _type("Segmentation"), _decoder(decoder), _ownsDecoder(false) { +Segmentation::Segmentation(BitField64* newDecoder) : + _name("Segmentation"), _type("Segmentation"), _decoder(newDecoder), _ownsDecoder(false) { } /// Destructor @@ -51,9 +51,9 @@ Segmentation::~Segmentation() { } /// Determine the volume ID from the full cell ID by removing all local fields -VolumeID Segmentation::volumeID(const CellID& cellID) const { +VolumeID Segmentation::volumeID(const CellID& cID) const { map<string, StringParameter>::const_iterator it; - _decoder->setValue(cellID); + _decoder->setValue(cID); for (it = _indexIdentifiers.begin(); it != _indexIdentifiers.end(); ++it) { string identifier = it->second->typedValue(); (*_decoder)[identifier] = 0; @@ -62,22 +62,22 @@ VolumeID Segmentation::volumeID(const CellID& cellID) const { } /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours -void Segmentation::neighbours(const CellID& cellID, std::set<CellID>& neighbours) const { +void Segmentation::neighbours(const CellID& cID, std::set<CellID>& cellNeighbours) const { map<string, StringParameter>::const_iterator it; for (it = _indexIdentifiers.begin(); it != _indexIdentifiers.end(); ++it) { string identifier = it->second->typedValue(); - _decoder->setValue(cellID); + _decoder->setValue(cID); int currentValue = (*_decoder)[identifier]; // add both neighbouring cell IDs, don't add out of bound indices try { (*_decoder)[identifier] = currentValue - 1; - neighbours.insert(_decoder->getValue()); + cellNeighbours.insert(_decoder->getValue()); } catch (runtime_error& e) { // nothing to do } try { (*_decoder)[identifier] = currentValue + 1; - neighbours.insert(_decoder->getValue()); + cellNeighbours.insert(_decoder->getValue()); } catch (runtime_error& e) { // nothing to do } @@ -85,11 +85,11 @@ void Segmentation::neighbours(const CellID& cellID, std::set<CellID>& neighbours } /// Set the underlying decoder -void Segmentation::setDecoder(BitField64* decoder) { +void Segmentation::setDecoder(BitField64* newDecoder) { if (_ownsDecoder and _decoder != 0) { delete _decoder; } - _decoder = decoder; + _decoder = newDecoder; _ownsDecoder = false; } @@ -107,30 +107,31 @@ Parameter Segmentation::parameter(const std::string& parameterName) const { /// Access to all parameters Parameters Segmentation::parameters() const { - Parameters parameters; + Parameters pars; map<string, Parameter>::const_iterator it; for (it = _parameters.begin(); it != _parameters.end(); ++it) { - parameters.push_back(it->second); + pars.push_back(it->second); } - return parameters; + return pars; } /// Set all parameters from an existing set of parameters -void Segmentation::setParameters(const Parameters& parameters) { +void Segmentation::setParameters(const Parameters& pars) { Parameters::const_iterator it; - for (it = parameters.begin(); it != parameters.end(); ++it) { + for (it = pars.begin(); it != pars.end(); ++it) { Parameter p = *it; parameter(p->name())->value() = p->value(); } } /// Add a cell identifier to this segmentation. Used by derived classes to define their required identifiers -void Segmentation::registerIdentifier(const string& name, const string& description, string& identifier, +void Segmentation::registerIdentifier(const string& idName, const string& idDescription, string& identifier, const string& defaultValue) { - StringParameter idParameter = new TypedSegmentationParameter<string>(name, description, identifier, defaultValue, - SegmentationParameter::NoUnit, true); - _parameters[name] = idParameter; - _indexIdentifiers[name] = idParameter; + StringParameter idParameter = + new TypedSegmentationParameter<string>(idName, idDescription, identifier, defaultValue, + SegmentationParameter::NoUnit, true); + _parameters[idName] = idParameter; + _indexIdentifiers[idName] = idParameter; } /// Helper method to convert a bin number to a 1D position diff --git a/DDSegmentation/src/TiledLayerSegmentation.cpp b/DDSegmentation/src/TiledLayerSegmentation.cpp index e5357271ae1dc46889844c5e10851043eae4cd62..9b6a82911dae74a99e7baea6a9ef54e04165c0dd 100644 --- a/DDSegmentation/src/TiledLayerSegmentation.cpp +++ b/DDSegmentation/src/TiledLayerSegmentation.cpp @@ -95,8 +95,8 @@ TiledLayerSegmentation::LayerDimensions TiledLayerSegmentation::layerDimensions( } /// determine the position based on the cell ID -Vector3D TiledLayerSegmentation::position(const CellID& cellID) const { - _decoder->setValue(cellID); +Vector3D TiledLayerSegmentation::position(const CellID& cID) const { + _decoder->setValue(cID); int layerIndex = (*_decoder)[_identifierLayer]; double cellSizeX = layerGridSizeX(layerIndex); double cellSizeY = layerGridSizeY(layerIndex); @@ -109,8 +109,8 @@ Vector3D TiledLayerSegmentation::position(const CellID& cellID) const { } /// determine the cell ID based on the position CellID TiledLayerSegmentation::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, - const VolumeID& volumeID) const { - _decoder->setValue(volumeID); + const VolumeID& vID) const { + _decoder->setValue(vID); int layerIndex = (*_decoder)[_identifierLayer]; double cellSizeX = layerGridSizeX(layerIndex); double cellSizeY = layerGridSizeY(layerIndex);