Skip to content

Commit

Permalink
STYLE: Drop int from long int and short int
Browse files Browse the repository at this point in the history
cd ~/git/ITK
find * -type f |
  egrep -i -e '\.[it]?(cc|hh|[ch](\+\+|pp?|xx)?)$' |
  fgrep -v ThirdParty |
  xargs sed -i -r -e \
    's#([^"/A-Za-z_]|^)(long|short) int([^"/A-Za-z_]|$)#\1\2\3#g'
  • Loading branch information
Leengit committed Apr 6, 2022
1 parent 4bbccf2 commit e03a941
Show file tree
Hide file tree
Showing 37 changed files with 216 additions and 218 deletions.
4 changes: 2 additions & 2 deletions Examples/Segmentation/HoughTransform2DLinesImageFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ main(int argc, char * argv[])

for (auto i = static_cast<int>(-diag); i < static_cast<int>(diag); ++i)
{
localIndex[0] = static_cast<long int>(u[0] + i * v[0]);
localIndex[1] = static_cast<long int>(u[1] + i * v[1]);
localIndex[0] = static_cast<long>(u[0] + i * v[0]);
localIndex[1] = static_cast<long>(u[1] + i * v[1]);

OutputImageType::RegionType outputRegion =
localOutputImage->GetLargestPossibleRegion();
Expand Down
12 changes: 6 additions & 6 deletions Modules/Core/Common/include/itkIsNumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ template <>
struct IsNumber<signed char> : TrueType
{};
template <>
struct IsNumber<unsigned short int> : TrueType
struct IsNumber<unsigned short> : TrueType
{};
template <>
struct IsNumber<signed short int> : TrueType
struct IsNumber<signed short> : TrueType
{};
template <>
struct IsNumber<signed int> : TrueType
Expand All @@ -57,16 +57,16 @@ template <>
struct IsNumber<unsigned int> : TrueType
{};
template <>
struct IsNumber<signed long int> : TrueType
struct IsNumber<signed long> : TrueType
{};
template <>
struct IsNumber<unsigned long int> : TrueType
struct IsNumber<unsigned long> : TrueType
{};
template <>
struct IsNumber<signed long long int> : TrueType
struct IsNumber<signed long long> : TrueType
{};
template <>
struct IsNumber<unsigned long long int> : TrueType
struct IsNumber<unsigned long long> : TrueType
{};
template <>
struct IsNumber<float> : TrueType
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkOctreeNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ITKCommon_EXPORT OctreeNode
* member function. Behavior is undefined when the child is another Octree.
* \return A value between 0 and 255 to indicate the color of the Desired child.
*/
long int
long
GetColor() const;

/**
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/src/itkOctreeNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ OctreeNode::GetChild(const LeafIdentifierEnum ChildID)
return *m_Branch->GetLeaf(ChildID);
}

long int
long
OctreeNode::GetColor() const
{
if (m_Parent != nullptr)
{
const long int x = m_Branch - m_Parent->GetColorTable();
const long x = m_Branch - m_Parent->GetColorTable();

//
// you'll want to indicate that the branch
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkCompensatedSummationTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ itkCompensatedSummationTest(int, char *[])
itk::StdStreamStateSave coutState(std::cout);

using FloatType = float;
long int seedValue = 17;
long seedValue = 17;

constexpr FloatType expectedMean = 0.5;

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/test/itkModifiedTimeTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ itkModifiedTimeTest(int, char *[])
{

using Point = itk::Point<double, 3>;
using PointsContainer = itk::VectorContainer<unsigned long int, Point>;
using BoundingBox = itk::BoundingBox<unsigned long int, 3, double, PointsContainer>;
using PointsContainer = itk::VectorContainer<unsigned long, Point>;
using BoundingBox = itk::BoundingBox<unsigned long, 3, double, PointsContainer>;

Point p, q, r;

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkSliceIteratorTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ FillRegionSequential(itk::SmartPointer<itk::Image<TPixelType, VDimension>> I)
{
unsigned int iDim, ArrayLength, i;
itk::Size<VDimension> Index;
unsigned long int Location[VDimension];
unsigned long Location[VDimension];
unsigned int mult;
TPixelType value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ itkLabelImageGaussianInterpolateImageFunctionTest(int, char *[])
{
int test_status = EXIT_SUCCESS;
constexpr unsigned int Dimension = 2;
using PixelType = unsigned short int; // Label images should be integer value types
using PixelType = unsigned short; // Label images should be integer value types
using ImageType = itk::Image<PixelType, Dimension>;
using RegionType = ImageType::RegionType;
using SizeType = RegionType::SizeType;
Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Mesh/include/itkVTKPolyDataReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ VTKPolyDataReader<TOutputMesh>::GenerateData()
itkDebugMacro("pointLine " << pointLine);

// we must use long here because this is the exact type specified by scanf
long int numberOfPoints = NumericTraits<PointIdentifier>::ZeroValue();
long numberOfPoints = NumericTraits<PointIdentifier>::ZeroValue();

if (sscanf(pointLine.c_str(), "%ld", &numberOfPoints) != 1)
{
Expand Down Expand Up @@ -187,8 +187,8 @@ VTKPolyDataReader<TOutputMesh>::GenerateData()
//

// we must use long here because this is the exact type specified by scanf
long int numberOfPolygons = NumericTraits<CellIdentifier>::ZeroValue();
long int numberOfIndices = NumericTraits<CellIdentifier>::ZeroValue();
long numberOfPolygons = NumericTraits<CellIdentifier>::ZeroValue();
long numberOfIndices = NumericTraits<CellIdentifier>::ZeroValue();

if (sscanf(polygonLine.c_str(), "%ld %ld", &numberOfPolygons, &numberOfIndices) != 2)
{
Expand Down Expand Up @@ -216,8 +216,8 @@ VTKPolyDataReader<TOutputMesh>::GenerateData()
// Load the polygons into the itk::Mesh
//

long int numberOfCellPoints;
long int ids[3]; // need a signed type on input.
long numberOfCellPoints;
long ids[3]; // need a signed type on input.

for (CellIdentifier i = 0; i < itk::Math::CastWithRangeCheck<CellIdentifier>(numberOfPolygons); ++i)
{
Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Mesh/test/itkMeshTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,20 @@ itkMeshTest(int, char *[])
6 } };

// Insert cell of each kind
auto cellVectorContainer = MeshType::CellsVectorContainer::New();
int index = 0;
unsigned long int value = 1;
auto cellVectorContainer = MeshType::CellsVectorContainer::New();
int index = 0;
unsigned long value = 1;
for (std::map<itk::CellGeometryEnum, unsigned int>::iterator iter = cellPointMap.begin(); iter != cellPointMap.end();
++iter)
{
itk::CellGeometryEnum cellType = iter->first;
unsigned int numOfPoints = iter->second;

// Insert cell type
cellVectorContainer->InsertElement(index++, static_cast<unsigned long int>(cellType));
cellVectorContainer->InsertElement(index++, static_cast<unsigned long>(cellType));

// Insert number of points
cellVectorContainer->InsertElement(index++, static_cast<unsigned long int>(numOfPoints));
cellVectorContainer->InsertElement(index++, static_cast<unsigned long>(numOfPoints));

// Insert the points
for (unsigned int i = 0; i < numOfPoints; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ itkMRIBiasFieldCorrectionFilterTest(int, char *[])
// ITK_TEST_SET_GET_VALUE( initCoefficients, filter->GetInitialBiasFieldCoefficients() );

// timing
long int t1 = time(nullptr);
long t1 = time(nullptr);
filter->Update();
long int t2 = time(nullptr);
long t2 = time(nullptr);
std::cout << "Run time (in s)" << t2 - t1 << std::endl;

sumOfError = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ itkDiffusionTensor3DReconstructionImageFilterTest(int argc, char * argv[])
return EXIT_FAILURE;
}

using ReferencePixelType = short int;
using GradientPixelType = short int;
using ReferencePixelType = short;
using GradientPixelType = short;
using TensorPrecisionType = double;

int result(EXIT_SUCCESS);
Expand Down Expand Up @@ -107,7 +107,7 @@ itkDiffusionTensor3DReconstructionImageFilterTest(int argc, char * argv[])
git.GoToBegin();
while (!git.IsAtEnd())
{
auto fancyGradientValue = static_cast<short int>((i + 1) * (i + 1) * (i + 1));
auto fancyGradientValue = static_cast<short>((i + 1) * (i + 1) * (i + 1));
git.Set(fancyGradientValue);
++git;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ CreateCircle(typename ImageType::Pointer image, const CenterCoordinateType cente
{
for (double angle = 0; angle <= 2 * itk::Math::pi; angle += itk::Math::pi / 1000)
{
index[0] = itk::Math::Round<long int>(center[0] + i * std::cos(angle));
index[1] = itk::Math::Round<long int>(center[1] + i * std::sin(angle));
index[0] = itk::Math::Round<long>(center[0] + i * std::cos(angle));
index[1] = itk::Math::Round<long>(center[1] + i * std::sin(angle));
image->SetPixel(index, 255);
}
}
Expand Down Expand Up @@ -507,15 +507,15 @@ itkHoughTransform2DCirclesImageTest(int, char *[])
// Draw the circle
for (double angle = 0; angle <= 2 * itk::Math::pi; angle += itk::Math::pi / 1000)
{
index[0] = itk::Math::Round<long int>(it_output.GetIndex()[0] + radius2 * std::cos(angle));
index[1] = itk::Math::Round<long int>(it_output.GetIndex()[1] + radius2 * std::sin(angle));
index[0] = itk::Math::Round<long>(it_output.GetIndex()[0] + radius2 * std::cos(angle));
index[1] = itk::Math::Round<long>(it_output.GetIndex()[1] + radius2 * std::sin(angle));
m_HoughSpaceImage->SetPixel(index, 255);

// Remove the maximum from the accumulator
for (double length = 0; length < discRadiusRatio * radius2; length += 1)
{
index[0] = itk::Math::Round<long int>(it_output.GetIndex()[0] + length * std::cos(angle));
index[1] = itk::Math::Round<long int>(it_output.GetIndex()[1] + length * std::sin(angle));
index[0] = itk::Math::Round<long>(it_output.GetIndex()[0] + length * std::cos(angle));
index[1] = itk::Math::Round<long>(it_output.GetIndex()[1] + length * std::sin(angle));
postProcessImage->SetPixel(index, 0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ itkHoughTransform2DLinesImageTest(int, char *[])

for (unsigned int i = 0; i < numberOfPixels; i += 1)
{
index[0] = static_cast<long int>(Vx - VyNorm * i);
index[1] = static_cast<long int>(Vy + VxNorm * i);
index[0] = static_cast<long>(Vx - VyNorm * i);
index[1] = static_cast<long>(Vy + VxNorm * i);

if (index[0] < static_cast<long>(size[0]) && index[0] >= 0 && index[1] < static_cast<long>(size[1]) &&
index[1] >= 0)
Expand Down Expand Up @@ -300,8 +300,8 @@ itkHoughTransform2DLinesImageTest(int, char *[])
{
for (double length = 0; length < discRadius; length += 1)
{
index[0] = static_cast<long int>(it_input.GetIndex()[0] + length * std::cos(angle));
index[1] = static_cast<long int>(it_input.GetIndex()[1] + length * std::sin(angle));
index[0] = static_cast<long>(it_input.GetIndex()[0] + length * std::cos(angle));
index[1] = static_cast<long>(it_input.GetIndex()[1] + length * std::sin(angle));
if (index[0] <= std::sqrt(400.0 * 400 + 400 * 400) && index[0] >= 0 && index[1] <= angleResolution &&
index[1] >= 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ itkBinShrinkImageFilterTest1(int, char *[])

// type alias to simplify the syntax
using InputImageType = itk::Image<int, 2>;
using OutputImageType = itk::Image<long int, 2>;
using OutputImageType = itk::Image<long, 2>;
auto sourceImage = InputImageType::New();

// fill in an image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ PolylineMaskImageFilter<TInputImage, TPolyline, TVector, TOutputImage>::Generate
using CornerPointType = Point<double, 3>;
using CornerPointProjectionType = Point<double, 2>;

using BoundingBoxType = BoundingBox<unsigned long int, 2, double>;
using BoundingBoxType = BoundingBox<unsigned long, 2, double>;
using CornerPointProjectionContainer = BoundingBoxType::PointsContainer;

auto cornerPointProjectionlist = CornerPointProjectionContainer::New();
Expand Down
28 changes: 14 additions & 14 deletions Modules/Filtering/Thresholding/include/itkLiThresholdCalculator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ LiThresholdCalculator<THistogram, TOutput>::GenerateData()

unsigned int size = histogram->GetSize(0);

long int histthresh;
int ih;
int num_pixels;
double sum_back; // sum of the background pixels at a given threshold
double sum_obj; // sum of the object pixels at a given threshold
int num_back; // number of background pixels at a given threshold
int num_obj; // number of object pixels at a given threshold
double old_thresh;
double new_thresh;
double mean_back; // mean of the background pixels at a given threshold
double mean_obj; // mean of the object pixels at a given threshold
double mean; // mean gray-level in the image
double tolerance; // threshold tolerance
double temp;
long histthresh;
int ih;
int num_pixels;
double sum_back; // sum of the background pixels at a given threshold
double sum_obj; // sum of the object pixels at a given threshold
int num_back; // number of background pixels at a given threshold
int num_obj; // number of object pixels at a given threshold
double old_thresh;
double new_thresh;
double mean_back; // mean of the background pixels at a given threshold
double mean_obj; // mean of the object pixels at a given threshold
double mean; // mean gray-level in the image
double tolerance; // threshold tolerance
double temp;

// If there are negative values then shift the values to zero.
const double bin_min = std::min(static_cast<double>(histogram->GetBinMin(0, 0)), 0.0);
Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/BioRad/src/itkBioRadImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ BioRadImageIO::Write(const void * buffer)
}
memset(p, 0, BIORAD_HEADER_LENGTH); // Set everything to zero
// In particular `notes' needs to be set to zero to indicate there is no notes
header.nx = static_cast<unsigned short int>(m_Dimensions[0]);
header.ny = static_cast<unsigned short int>(m_Dimensions[1]);
header.nx = static_cast<unsigned short>(m_Dimensions[0]);
header.ny = static_cast<unsigned short>(m_Dimensions[1]);
if (m_NumberOfDimensions == 3)
{
header.npic = static_cast<unsigned short int>(m_Dimensions[2]);
header.npic = static_cast<unsigned short>(m_Dimensions[2]);
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions Modules/IO/GDCM/src/itkGDCMImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ GDCMImageIO::CanReadFile(const char * filename)
// There isn't a definitive way to check for DICOM files;
// This was actually cribbed from DICOMParser in VTK
bool dicomsig(false);
for (long int off = 128; off >= 0; off -= 128)
for (long off = 128; off >= 0; off -= 128)
{
file.seekg(off, std::ios_base::beg);
if (file.fail() || file.eof())
Expand Down Expand Up @@ -1207,10 +1207,10 @@ GDCMImageIO::Write(const void * buffer)
{
if (!bitsAllocated.empty() && !bitsStored.empty() && !highBit.empty() && !pixelRep.empty())
{
outpixeltype.SetBitsAllocated(static_cast<unsigned short int>(std::stoi(bitsAllocated.c_str())));
outpixeltype.SetBitsStored(static_cast<unsigned short int>(std::stoi(bitsStored.c_str())));
outpixeltype.SetHighBit(static_cast<unsigned short int>(std::stoi(highBit.c_str())));
outpixeltype.SetPixelRepresentation(static_cast<unsigned short int>(std::stoi(pixelRep.c_str())));
outpixeltype.SetBitsAllocated(static_cast<unsigned short>(std::stoi(bitsAllocated.c_str())));
outpixeltype.SetBitsStored(static_cast<unsigned short>(std::stoi(bitsStored.c_str())));
outpixeltype.SetHighBit(static_cast<unsigned short>(std::stoi(highBit.c_str())));
outpixeltype.SetPixelRepresentation(static_cast<unsigned short>(std::stoi(pixelRep.c_str())));
if (this->GetNumberOfComponents() != 1)
{
itkExceptionMacro(<< "Sorry Dave I can't do that");
Expand Down
8 changes: 4 additions & 4 deletions Modules/IO/GE/src/itkGE4ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ GE4ImageIO::ReadHeader(const char * FileNameToRead)
strcpy(hdr->modality, "UNK");

// RGEDEBUG(char debugbuf[16384];)
char tmpStr[IOCommon::ITK_MAXPATHLEN + 1];
int intTmp;
short int tmpShort;
float tmpFloat;
char tmpStr[IOCommon::ITK_MAXPATHLEN + 1];
int intTmp;
short tmpShort;
float tmpFloat;

//
// save off the name of the current file...
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/GE/src/itkGE5ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ GE5ImageIO::ReadHeader(const char * FileNameToRead)
curImage->imageXres = hdr2Float(buffer + VOff(50, 52));
curImage->imageYres = hdr2Float(buffer + VOff(54, 56));

short int GE_Plane(hdr2Short(buffer + VOff(114, 116)));
short GE_Plane(hdr2Short(buffer + VOff(114, 116)));
switch (GE_Plane)
{
case GE_CORONAL:
Expand Down
Loading

0 comments on commit e03a941

Please sign in to comment.