Skip to content

Commit

Permalink
COMP: Remove shadow variables
Browse files Browse the repository at this point in the history
PointType was redefined and showed in several places.
  • Loading branch information
hjmjohnson committed Jul 6, 2015
1 parent 6749569 commit e6014de
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion BRAINSCommonLib/Slicer3LandmarkIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ ReadSlicer3toITKLmk( const std::string & landmarksFilename )
{
size_t pos1 = line.find( ',', 0 );
const std::string name = line.substr( 0, pos1 );
PointType labelPos;
LandmarkPointType labelPos;
for( unsigned int i = 0; i < 3; ++i )
{
const size_t pos2 = line.find( ',', pos1 + 1 );
Expand Down
8 changes: 4 additions & 4 deletions BRAINSCommonLib/Slicer3LandmarkIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
* system) to Slicer3 landmarks (in RAS coordinate system).
*/

typedef itk::Point<double, 3> PointType;
typedef std::map<std::string, PointType> LandmarksMapType;
typedef std::map<std::string, float> LandmarkWeightMapType;
typedef std::map<std::string, double> LandmarksWeightMapType;
typedef itk::Point<double, 3> LandmarkPointType;
typedef std::map<std::string, LandmarkPointType> LandmarksMapType;
typedef std::map<std::string, float> LandmarkWeightMapType;
typedef std::map<std::string, double> LandmarksWeightMapType;

/*
* Read lmk weights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ int main( int argc, char * argv[] )
unsigned int numNamedLandmarks = 0;
double x_ave, y_ave, z_ave;

std::map<std::string, PointType> LandmarksAverageMap;
std::map<std::string, LandmarkPointType> LandmarksAverageMap;

typedef std::vector<std::map<std::string, PointType> > LandmarksMapTypeVec;
typedef std::vector<std::map<std::string, LandmarkPointType> > LandmarksMapTypeVec;
LandmarksMapTypeVec LandmarksMapVector;

// LandmarksMapType is as "std::map<std::string, PointType>" which means a map between landmarks and their
// LandmarksMapType is as "std::map<std::string, LandmarkPointType>" which means a map between landmarks and their
// coordinates.
// For each input landmark file this LandmarksMapType is computed and is set in a vector: "LandmarksMapTypeVec"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ int main( int argc, char * argv[] )
std::map<std::string, double> LandmarksVarianceMap; // for variance
std::map<std::string, double> LandmarksSTDMap; // for standard deviation

typedef std::vector<std::map<std::string, PointType> > LandmarksMapTypeVec;
typedef std::vector<std::map<std::string, LandmarkPointType> > LandmarksMapTypeVec;
LandmarksMapTypeVec LandmarksMapVector;

// LandmarksMapType is as "std::map<std::string, PointType>" which means a map between landmarks and their
// LandmarksMapType is as "std::map<std::string, LandmarkPointType>" which means a map between landmarks and their
// coordinates.
// For each input landmark file this LandmarksMapType is computed and is set in a vector: "LandmarksMapTypeVec"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class ThreeLandmarksForPlane
// The definition depends on Slicer3LandmarkIO.
// Point type is simply itk::Pointe<double, 3>
public:
PointType A;
PointType B;
PointType C;
LandmarkPointType A;
LandmarkPointType B;
LandmarkPointType C;

typedef itk::Point<double, 3> VectorType;

Expand Down Expand Up @@ -97,7 +97,7 @@ class ThreeLandmarksForPlane
<< std::endl;
}

double GetRelativeLocationToPlane( PointType x )
double GetRelativeLocationToPlane( LandmarkPointType x )
{
double answer =
normal[0] * ( A[0] - x[0] )
Expand Down Expand Up @@ -129,7 +129,7 @@ CutBinaryVolumeByPlaneWithDirection( typename TImageType::Pointer * _imageVolume
std::cout << __LINE__ << "::" << __FILE__ << std::endl;
for( it.GoToBegin(); !it.IsAtEnd(); ++it )
{
PointType currentPhysicalLocation;
LandmarkPointType currentPhysicalLocation;
(*_imageVolume)->TransformIndexToPhysicalPoint( it.GetIndex(), currentPhysicalLocation );

if( direction == "true" &&
Expand All @@ -149,7 +149,7 @@ CutBinaryVolumeByPlaneWithDirection( typename TImageType::Pointer * _imageVolume
template <class TImageType>
void
CutBinaryVolumeByPointWithDirection( typename TImageType::Pointer * _imageVolume,
const PointType _landmark,
const LandmarkPointType _landmark,
const std::string & _direction )
{
// set directional constant for convenient programming
Expand Down Expand Up @@ -193,7 +193,7 @@ CutBinaryVolumeByPointWithDirection( typename TImageType::Pointer * _imageVolume
std::cout << __LINE__ << "::" << __FILE__ << std::endl;
for( it.GoToBegin(); !it.IsAtEnd(); ++it )
{
PointType currentPhysicalLocation;
LandmarkPointType currentPhysicalLocation;
(*_imageVolume)->TransformIndexToPhysicalPoint( it.GetIndex(), currentPhysicalLocation );

switch( myDirection )
Expand Down Expand Up @@ -319,7 +319,7 @@ int main( int argc, char * argv[] )
std::exit( EXIT_FAILURE );
}

PointType currentLdmk = landmarksSet.find( *ldmkIt )->second;
LandmarkPointType currentLdmk = landmarksSet.find( *ldmkIt )->second;
std::cout << "currentLdmk:: " << *ldmkIt << "::"
<< currentLdmk[0] << ", "
<< currentLdmk[1] << ", "
Expand Down Expand Up @@ -375,7 +375,7 @@ int main( int argc, char * argv[] )
std::cerr << "ERROR: Landmark not found: " << *inputLdmrIt << std::endl;
std::exit( EXIT_FAILURE );
}
PointType currentLandmark = landmarksSet.find( *inputLdmrIt )->second;
LandmarkPointType currentLandmark = landmarksSet.find( *inputLdmrIt )->second;
std::cout << "currentLandmark:: " << *inputLdmrIt << "::"
<< currentLandmark[0] << ", "
<< currentLandmark[1] << ", "
Expand Down
14 changes: 4 additions & 10 deletions BRAINSConstellationDetector/src/insertMidACPCpoint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,13 @@ int main( int argc, char * argv[] )
PARSE_ARGS;
BRAINSRegisterAlternateIO();

std::map<std::string, PointType> lmksMap;
PointType ACpoint;
PointType PCpoint;
PointType midACPCpoint;

lmksMap = ReadSlicer3toITKLmk(inputLandmarkFile);
std::map<std::string, LandmarkPointType> lmksMap = ReadSlicer3toITKLmk(inputLandmarkFile);

ACpoint = lmksMap["AC"];
PCpoint = lmksMap["PC"];
const LandmarkPointType ACpoint = lmksMap["AC"];
const LandmarkPointType PCpoint = lmksMap["PC"];

midACPCpoint[0] = (PCpoint[0] - ACpoint[0]) / 2;
midACPCpoint[1] = (PCpoint[1] - ACpoint[1]) / 2;
midACPCpoint[2] = (PCpoint[2] - ACpoint[2]) / 2;
const LandmarkPointType midACPCpoint = (PCpoint - ACpoint) * 0.5;

// std::cout << "PC :" << PCpoint[0] << ", " << PCpoint[1] << ", " << PCpoint[2] << ")" << std::endl;
// std::cout << "midpoint :" << midACPCpoint[0] << ", " << midACPCpoint[1] << ", " << midACPCpoint[2] << ")" <<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@

// D E F I N E S //////////////////////////////////////////////////////////////

typedef std::map<std::string, std::vector<double> > LandmarksDistanceMapType;
typedef std::map<std::string, double> LandmarksValueMapType;
typedef std::vector<std::map<std::string, PointType> > LandmarksMapTypeVec;
typedef std::map<std::string, std::vector<double> > LandmarksDistanceMapType;
typedef std::map<std::string, double> LandmarksValueMapType;
typedef std::vector<std::map<std::string, LandmarkPointType> > LandmarksMapTypeVec;

// F U N C T I O N S //////////////////////////////////////////////////////////

Expand Down

0 comments on commit e6014de

Please sign in to comment.