Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/IO/XML/itkParticleSwarmOptimizerSAXReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ bool ParticleSwarmOptimizerSAXReader::ContextIs( const char* test ) const
{
s += "/" + std::string(currentTag);
}
if ( s.size() == 0 )
if ( s.empty() )
{
s = "/";
}
Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/Common/include/itkPolygonCell.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void
PolygonCell< TCellInterface >
::BuildEdges()
{
if ( m_PointIds.size() > 0 )
if ( !m_PointIds.empty() )
{
m_Edges.resize( m_PointIds.size() );
const auto numberOfPoints = static_cast< unsigned int >( m_PointIds.size() );
Expand Down Expand Up @@ -291,7 +291,7 @@ typename PolygonCell< TCellInterface >::PointIdIterator
PolygonCell< TCellInterface >
::PointIdsBegin()
{
if ( m_PointIds.size() > 0 )
if ( !m_PointIds.empty() )
{
return &*( m_PointIds.begin() );
}
Expand All @@ -311,7 +311,7 @@ typename PolygonCell< TCellInterface >::PointIdConstIterator
PolygonCell< TCellInterface >
::PointIdsBegin() const
{
if ( m_PointIds.size() > 0 )
if ( !m_PointIds.empty() )
{
return &*( m_PointIds.begin() );
}
Expand All @@ -330,7 +330,7 @@ typename PolygonCell< TCellInterface >::PointIdIterator
PolygonCell< TCellInterface >
::PointIdsEnd()
{
if ( m_PointIds.size() > 0 )
if ( !m_PointIds.empty() )
{
return &m_PointIds[m_PointIds.size() - 1] + 1;
}
Expand All @@ -350,7 +350,7 @@ typename PolygonCell< TCellInterface >::PointIdConstIterator
PolygonCell< TCellInterface >
::PointIdsEnd() const
{
if ( m_PointIds.size() > 0 )
if ( !m_PointIds.empty() )
{
return &m_PointIds[m_PointIds.size() - 1] + 1;
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkTreeNode.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool
TreeNode< TValue >
::HasChildren() const
{
return ( m_Children.size() > 0 ) ? true : false;
return ( !m_Children.empty() ) ? true : false;
}

/** Return the number of children */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/src/itkFileOutputWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ::Initialize()
{
if ( !m_Stream )
{
if ( m_FileName == "" )
if ( m_FileName.empty() )
{
m_FileName = "itkMessageLog.txt";
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/src/itkMultiThreaderBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ ThreadIdType MultiThreaderBase::GetGlobalDefaultNumberOfThreads()
std::string item;
while( std::getline(numberOfThreadsEnvListStream, item, ':') )
{
if( item.size() > 0 ) // Do not add empty items.
if( !item.empty() ) // Do not add empty items.
{
ITK_NUMBER_OF_THREADS_ENV_LIST.push_back(item);
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/src/itkObjectFactoryBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ ::LoadDynamicFactories()
{
return;
}
if ( LoadPath.size() == 0 )
if ( LoadPath.empty() )
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/src/itkThreadPool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ::GetNumberOfCurrentlyIdleThreads() const
ThreadPool
::~ThreadPool()
{
bool waitForThreads = m_Threads.size() > 0;
bool waitForThreads = !m_Threads.empty();
#if defined(_WIN32) && defined(ITKCommon_EXPORTS)
//This destructor is called during DllMain's DLL_PROCESS_DETACH.
//Because ITKCommon-4.X.dll is usually being detached due to process termination,
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/src/itkXMLFileOutputWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ::Initialize()
{
if ( !m_Stream )
{
if ( m_FileName == "" )
if ( m_FileName.empty() )
{
m_FileName = "itkMessageLog.xml";
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkColorTableTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int ColorTableTestSpecialConditionChecker(
}

std::string name = colors->GetColorName( numberOfColors );
if( name != "" )
if( !name.empty() )
{
std::cerr << "Test failed!" << std::endl;
std::cerr << "Error in itk::ColorTable::GetColorName" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkNeighborhoodAlgorithmTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool ImageBoundaryFaceCalculatorTest(TImage * image, typename TImage::RegionType
}
}

if( !faceList.size() )
if( faceList.empty() )
return true;

image->FillBuffer(0);
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ ConnectedRegionsMeshFilter< TInputMesh, TOutputMesh >
CellsContainerConstIterator cell;
CellDataContainerConstIterator cellData;
bool CellDataPresent = ( nullptr != inCellData
&& 0 != inCellData->size() );
&& !inCellData->empty() );
InputMeshCellPointer cellCopy; // need an autopointer to duplicate
// a cell

Expand Down Expand Up @@ -443,7 +443,7 @@ ConnectedRegionsMeshFilter< TInputMesh, TOutputMesh >
std::vector< IdentifierType > * tmpWave;
typename std::set< InputMeshCellIdentifier >::iterator citer;

while ( m_Wave->size() > 0 )
while ( !m_Wave->empty() )
{
for ( i = m_Wave->begin(); i != m_Wave->end(); ++i )
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Mesh/include/itkVTKPolyDataReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ VTKPolyDataReader< TOutputMesh >
outputMesh->SetCellsAllocationMethod(
OutputMeshType::CellsAllocatedDynamicallyCellByCell);

if ( m_FileName == "" )
if ( m_FileName.empty() )
{
itkExceptionMacro(<< "No input FileName");
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Mesh/include/itkVTKPolyDataWriter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void
VTKPolyDataWriter< TInputMesh >
::GenerateData()
{
if ( this->m_FileName == "" )
if ( this->m_FileName.empty() )
{
itkExceptionMacro("No FileName");
return;
Expand Down
10 changes: 5 additions & 5 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ QuadEdgeMesh< TPixel, VDimension, TTraits >
{

// sanity check
if( m_FreePointIndexes.size() == 0 )
if( m_FreePointIndexes.empty() )
{
return;
}
Expand All @@ -499,7 +499,7 @@ QuadEdgeMesh< TPixel, VDimension, TTraits >
QEType* EdgeRingIter;

// for all the free indexes and while there is any gap
while( ( m_FreePointIndexes.size() != 0 )
while( ( !m_FreePointIndexes.empty() )
&& ( last.Index() >= this->GetNumberOfPoints() ) )
{

Expand Down Expand Up @@ -622,7 +622,7 @@ QuadEdgeMesh< TPixel, VDimension, TTraits >
{
CellIdentifier cid;

if ( m_FreeCellIndexes.size() == 0 )
if ( m_FreeCellIndexes.empty() )
{
cid = this->GetNumberOfCells();

Expand Down Expand Up @@ -757,7 +757,7 @@ QuadEdgeMesh< TPixel, VDimension, TTraits >
{
CellIdentifier eid = 0;

if ( this->GetEdgeCells()->size() > 0 )
if ( !this->GetEdgeCells()->empty() )
{
CellsContainerConstIterator last = this->GetEdgeCells()->End();
--last;
Expand Down Expand Up @@ -1110,7 +1110,7 @@ typename QuadEdgeMesh< TPixel, VDimension, TTraits >::QEPrimal *
QuadEdgeMesh< TPixel, VDimension, TTraits >
::GetEdge() const
{
if ( this->GetEdgeCells()->size() == 0 )
if ( this->GetEdgeCells()->empty() )
{
return ( (QEPrimal *)nullptr );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshPolygonCell:public TCellInterface
{
// NOTE ALEX: should update the array on the fly to make it faster
MakePointIds();
if ( m_PointIds.size() == 0 )
if ( m_PointIds.empty() )
{
return ( static_cast< PointIdIterator >( nullptr ) );
}
Expand All @@ -186,7 +186,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshPolygonCell:public TCellInterface
PointIdIterator PointIdsEnd() override
{
// NOTE ALEX: should update the array on the fly to make it faster
if ( m_PointIds.size() == 0 )
if ( m_PointIds.empty() )
{
return ( static_cast< PointIdIterator >( nullptr ) );
}
Expand All @@ -200,7 +200,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshPolygonCell:public TCellInterface
{
// NOTE ALEX: should update the array on the fly to make it faster
MakePointIds();
if ( m_PointIds.size() == 0 )
if ( m_PointIds.empty() )
{
return ( static_cast< PointIdIterator >( nullptr ) );
}
Expand All @@ -213,7 +213,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshPolygonCell:public TCellInterface
PointIdConstIterator PointIdsEnd() const override
{
// NOTE ALEX: should update the array on the fly to make it faster
if ( m_PointIds.size() == 0 )
if ( m_PointIds.empty() )
{
return ( static_cast< PointIdIterator >( nullptr ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ QuadEdgeMeshScalarDataVTKPolyDataWriter< TMesh >
outputFile << "CELL_DATA " << this->m_Input->GetNumberOfFaces() << std::endl;
outputFile << "SCALARS ";

if ( m_CellDataName != "" )
if ( !m_CellDataName.empty() )
{
outputFile << m_CellDataName << " " << m_CellDataName << std::endl;
}
Expand Down Expand Up @@ -119,7 +119,7 @@ QuadEdgeMeshScalarDataVTKPolyDataWriter< TMesh >
outputFile << "POINT_DATA " << this->m_Input->GetNumberOfPoints() << std::endl;
outputFile << "SCALARS ";

if ( m_PointDataName != "" )
if ( !m_PointDataName.empty() )
{
outputFile << m_PointDataName << " " << m_PointDataName << std::endl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ DTITubeSpatialObjectPoint< TPointDimension >
{
std::string charname = this->TranslateEnumToChar(name);

if ( charname.size() > 0 )
if ( !charname.empty() )
{
this->SetField(charname.c_str(), value);
}
Expand All @@ -130,7 +130,7 @@ DTITubeSpatialObjectPoint< TPointDimension >
{
std::string charname = this->TranslateEnumToChar(name);

if ( charname.size() > 0 )
if ( !charname.empty() )
{
FieldType field(itksys::SystemTools::LowerCase(charname).c_str(), value);
m_Fields.push_back(field);
Expand Down Expand Up @@ -169,7 +169,7 @@ DTITubeSpatialObjectPoint< TPointDimension >
::GetField(FieldEnumType name) const
{
std::string charname = this->TranslateEnumToChar(name);
if ( charname.size() > 0 )
if ( !charname.empty() )
{
return this->GetField( itksys::SystemTools::LowerCase(charname).c_str() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ MetaImageConverter< NDimensions, PixelType, TSpatialObjectType >
if ( this->GetWriteImagesInSeparateFile())
{
std::string filename = imageSO->GetProperty()->GetName();
if ( filename.size() == 0 )
if ( filename.empty() )
{
std::cout << "Error: you should set the image name when using"
<< " WriteImagesInSeparateFile." << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int itkSceneSpatialObjectTest(int, char* [])
std::cout << "[PASSED]" << std::endl;

std::cout << "Testing BoundingBoxChildrenName: ";
if(object->GetBoundingBoxChildrenName() != "")
if(!object->GetBoundingBoxChildrenName().empty())
{
std::cout << "[FAILURE]" << std::endl;
return EXIT_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int itkSpatialObjectDuplicatorTest(int, char* [])
found = true;
unsigned int value=0;

if(dtiTube_copy->GetPoints().size() == 0)
if(dtiTube_copy->GetPoints().empty())
{
std::cout<<" [FAILED] : Size of the point list is zero" <<std::endl;
return EXIT_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ PipelineMonitorImageFilter<TImageType>
itkWarningMacro(<<"input: " << input->GetLargestPossibleRegion() << "updated: " << m_UpdatedOutputLargestPossibleRegion );
return false;
}
if(m_UpdatedBufferedRegions.size() && !m_UpdatedOutputLargestPossibleRegion.IsInside(m_UpdatedBufferedRegions.back()))
if(!m_UpdatedBufferedRegions.empty() && !m_UpdatedOutputLargestPossibleRegion.IsInside(m_UpdatedBufferedRegions.back()))
{
itkWarningMacro(<<"The input filter's BufferedRegion is not contained by LargestPossibleRegion");
return false;
Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/BMP/src/itkBMPImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bool BMPImageIO::CanReadFile(const char *filename)
// First check the filename
std::string fname = filename;

if ( fname == "" )
if ( fname.empty() )
{
itkDebugMacro(<< "No filename specified.");
}
Expand Down Expand Up @@ -152,7 +152,7 @@ bool BMPImageIO::CanWriteFile(const char *name)
{
std::string filename = name;

if ( filename == "" )
if ( filename.empty() )
{
itkDebugMacro(<< "No filename specified.");
}
Expand Down Expand Up @@ -971,7 +971,7 @@ void BMPImageIO::PrintSelf(std::ostream & os, Indent indent) const
{
os << "Read as Scalar Image plus palette" << "\n";
}
if( m_ColorPalette.size() > 0 )
if( !m_ColorPalette.empty() )
{
os << indent << "ColorPalette:" << std::endl;
for( unsigned int i = 0; i < m_ColorPalette.size(); ++i )
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/BioRad/src/itkBioRadImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ bool BioRadImageIO::CanReadFile(const char *filename)
std::ifstream file;
std::string fname(filename);

if ( fname == "" )
if ( fname.empty() )
{
itkDebugMacro(<< "No filename specified.");
return false;
Expand Down Expand Up @@ -389,7 +389,7 @@ bool BioRadImageIO::CanWriteFile(const char *name)
{
std::string filename = name;

if ( filename == "" )
if ( filename.empty() )
{
itkDebugMacro(<< "No filename specified.");
return false;
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/CSV/include/itkCSVNumericObjectFileWriter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CSVNumericObjectFileWriter<TValue,NRows,NColumns>
::PrepareForWriting()
{
// throw an exception if no filename is provided
if ( this->m_FileName == "" )
if ( this->m_FileName.empty() )
{
itkExceptionMacro( << "A filename for writing was not specified!" );
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/CSV/src/itkCSVFileReaderBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void
CSVFileReaderBase
::PrepareForParsing()
{
if ( this->m_FileName == "" )
if ( this->m_FileName.empty() )
{
itkExceptionMacro( << "There is no file name provided!"
<< "Please provide a filename." );
Expand Down
Loading