From aeb9ffefa6ae15f2d0f8d008fa98170877fb11a8 Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Tue, 31 Mar 2015 09:48:07 +0000 Subject: [PATCH] DDSegmentation: Fix shadow warnings --- .../include/DDSegmentation/CartesianGridXY.h | 8 ++-- .../include/DDSegmentation/CartesianGridXYZ.h | 4 +- .../include/DDSegmentation/CartesianGridXZ.h | 8 ++-- .../include/DDSegmentation/CartesianGridYZ.h | 8 ++-- .../include/DDSegmentation/PolarGridRPhi.h | 8 ++-- .../include/DDSegmentation/PolarGridRPhi2.h | 16 ++++---- .../DDSegmentation/ProjectiveCylinder.h | 8 ++-- .../DDSegmentation/TiledLayerSegmentation.h | 16 ++++---- DDSegmentation/src/BitField64.cpp | 14 +++---- DDSegmentation/src/CartesianGridXY.cpp | 16 ++++---- DDSegmentation/src/CartesianGridXYZ.cpp | 18 ++++---- DDSegmentation/src/CartesianGridXZ.cpp | 16 ++++---- DDSegmentation/src/CartesianGridYZ.cpp | 16 ++++---- DDSegmentation/src/PolarGridRPhi.cpp | 16 ++++---- DDSegmentation/src/PolarGridRPhi2.cpp | 16 ++++---- DDSegmentation/src/ProjectiveCylinder.cpp | 16 ++++---- DDSegmentation/src/Segmentation.cpp | 41 ++++++++++--------- DDSegmentation/src/TiledLayerSegmentation.cpp | 8 ++-- 18 files changed, 127 insertions(+), 126 deletions(-) diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h index e8adf981b..55b674e86 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 2365dd4ec..d13cb09b9 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 d0febe4e5..583d55ed0 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 37479f157..322291f41 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 311c978f7..46d2d698e 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 7721ae174..c504915cf 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 56e5447ef..260dde658 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 94aed501b..9b6f9b0af 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 1deac192d..47e744dab 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 c079be45e..4c9e8867c 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 716cc14a4..5d4b62e54 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 a2490733f..5a4043ad3 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 52395855f..42515bd3e 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 ee0436022..dbf0bcf9c 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 b82c05bd4..dc6282a6e 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 1f2dd38b3..41878e1f1 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 ccd38fb40..b284acc56 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 e5357271a..9b6a82911 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); -- GitLab