]> Creatis software - clitk.git/commitdiff
Remove warnings
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Wed, 30 Nov 2011 09:45:50 +0000 (10:45 +0100)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Wed, 30 Nov 2011 09:45:50 +0000 (10:45 +0100)
- Remove warnings with -Wall
  It remains some warning about gengetopt generated files
- Use ImageDimension instead of 3 in some filters

20 files changed:
common/clitkFilterBase.txx
common/clitkGateAsciiImageIO.cxx
common/clitkHndImageIO.cxx
common/clitkXdrImageIOReader.cxx
itk/clitkBackProjectImageFilter.txx
itk/clitkComposeVFFilter.txx
itk/clitkForwardWarpImageFilter.txx
itk/clitkInvertVFFilter.txx
itk/clitkRelativePositionAnalyzerFilter.txx
itk/clitkRelativePositionDataBase.cxx
itk/clitkRelativePositionDataBaseAnalyzerFilter.txx
itk/clitkRelativePositionDataBaseBuilderFilter.txx
registration/clitkBLUTDIRGenericFilter.cxx
registration/clitkShapedBLUTSpatioTemporalDeformableTransform.txx
segmentation/clitkExtractLymphStation_Supports.txx
segmentation/clitkExtractLymphStationsFilter.txx
segmentation/clitkMorphoMathFilter.txx
segmentation/clitkStructuresExtractionFilter.txx
tools/clitkMedianImageGenericFilter.txx
tools/clitkRelativePositionDataBaseBuilderGenericFilter.txx

index d6c028e..fe175e1 100644 (file)
@@ -70,7 +70,7 @@ void clitk::FilterBase::StopCurrentStep(typename TInternalImageType::Pointer p,
   clitk::PrintMemory(GetVerboseMemoryFlag(), "End of step"); 
   if (GetVerboseImageSizeFlag()) {
     std::ostream & os = std::cout;
-    int dim = p->GetImageDimension();
+    unsigned int dim = p->GetImageDimension();
     int nb = 1;
     os << txt << " size = ";
     for(unsigned int i=0; i<dim-1; i++) {
index f3d4a8d..744f413 100644 (file)
@@ -155,17 +155,11 @@ bool clitk::GateAsciiImageIO::ReadHeader(FILE* handle, GateAsciiHeader& header)
     regmatch_t matches[4];
 
     { // build regex
-       int ret = 0;
-       ret = regcomp(&re_comment,"^#.+$",REG_EXTENDED|REG_NEWLINE);
-       assert(ret == 0);
-       ret = regcomp(&re_matrix_size,"^# +Matrix *Size *= +\\(([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*)\\)$",REG_EXTENDED|REG_NEWLINE);
-       assert(ret == 0);
-       ret = regcomp(&re_resol,"^# +Resol *= +\\(([0-9]+),([0-9]+),([0-9]+)\\)$",REG_EXTENDED|REG_NEWLINE);
-       assert(ret == 0);
-       ret = regcomp(&re_voxel_size,"^# +Voxel *Size *= +\\(([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*)\\)$",REG_EXTENDED|REG_NEWLINE);
-       assert(ret == 0);
-       ret = regcomp(&re_nb_value,"^# +nbVal *= +([0-9]+)$",REG_EXTENDED|REG_NEWLINE);
-       assert(ret == 0);
+       assert(regcomp(&re_comment,"^#.+$",REG_EXTENDED|REG_NEWLINE) == 0);
+       assert(regcomp(&re_matrix_size,"^# +Matrix *Size *= +\\(([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*)\\)$",REG_EXTENDED|REG_NEWLINE) == 0);
+       assert(regcomp(&re_resol,"^# +Resol *= +\\(([0-9]+),([0-9]+),([0-9]+)\\)$",REG_EXTENDED|REG_NEWLINE) == 0);
+       assert(regcomp(&re_voxel_size,"^# +Voxel *Size *= +\\(([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*),([0-9]+\\.?[0-9]*)\\)$",REG_EXTENDED|REG_NEWLINE) == 0);
+       assert(regcomp(&re_nb_value,"^# +nbVal *= +([0-9]+)$",REG_EXTENDED|REG_NEWLINE) == 0);
     }
 
     if (!ReadLine(handle,line)) return false;
index bd8e518..44486c2 100644 (file)
@@ -132,7 +132,6 @@ void clitk::HndImageIO::Read(void * buffer)
   uint32_t* buf = (uint32_t*)buffer;
   unsigned char *pt_lut;
   uint32_t a;
-  float b;
   unsigned char v;
   int lut_idx, lut_off;
   size_t num_read;
@@ -155,13 +154,11 @@ void clitk::HndImageIO::Read(void * buffer)
   for (i = 0; i < GetDimensions(0); i++) {
     fread (&a, sizeof(uint32_t), 1, fp);
     buf[i] = a;
-    b = a;
   }
 
   /* Read first pixel of second row */
   fread (&a, sizeof(uint32_t), 1, fp);
   buf[i++] = a;
-  b = a;
 
   /* Decompress the rest */
   lut_idx = 0;
@@ -211,7 +208,6 @@ void clitk::HndImageIO::Read(void * buffer)
     }
 
     buf[i] = r21 + r12 + diff - r11;
-    b = buf[i];
     i++;
   }
 
index 07384ef..ee3f50b 100644 (file)
@@ -750,7 +750,7 @@ int clitk::XdrImageIO::ReadWithError(void * buffer)
   //int      forcenoswap=0;
   char     *file = const_cast<char *>(m_FileName.c_str());
   int      offset=0;
-  AVSType  field=UNIFORM;
+  // AVSType  field=UNIFORM;
 
   for (i=0; i<GetNumberOfDimensions(); i++) coords += GetDimensions(i);
 
@@ -759,9 +759,9 @@ int clitk::XdrImageIO::ReadWithError(void * buffer)
 
   c = scan_header(file, "field", offset, 1);
   if (c) {
-    if (memicmp(c, "unifo", 5) == 0) field=UNIFORM, coords=nspace*2;
-    else if (memicmp(c, "recti", 5) == 0) field=RECTILINEAR;
-    else if (memicmp(c, "irreg", 5) == 0) field=IRREGULAR, coords=total*nspace;
+    if (memicmp(c, "unifo", 5) == 0) /*field=UNIFORM,*/ coords=nspace*2;
+    // else if (memicmp(c, "recti", 5) == 0) field=RECTILINEAR;
+    else if (memicmp(c, "irreg", 5) == 0) /*field=IRREGULAR,*/ coords=total*nspace;
     else return ER_XDR_FIELD;
   } else
     coords=0;
index af78d84..9091f0d 100644 (file)
@@ -223,7 +223,7 @@ namespace clitk
   BackProjectImageFilter<InputImageType, OutputImageType>
   ::CalculateProjectionMatrix( void )
   {
-    InputSpacingType inputSpacing=this->GetInput()->GetSpacing();
+    //InputSpacingType inputSpacing=this->GetInput()->GetSpacing();
     
     // Projection on YZ plane+pixelTrans
     itk::Matrix<double,3,4> temp;
@@ -325,7 +325,6 @@ namespace clitk
     iPoint.Fill(itk::NumericTraits<double>::Zero);
     OutputIndexType oIndex;
     ContinuousInputIndexType iIndex;
-    InputSizeType inputSize=inputPtr->GetLargestPossibleRegion().GetSize();
 
     //Get the first output coordinate
     oIndex=iterator.GetIndex();//costly but only once a thread
index f0bf5a9..5cc5db1 100644 (file)
@@ -116,6 +116,7 @@ namespace clitk
                
                
                // get neighbor index and overlap fraction
+                bool neighbIndexSupZero = 1;
                for( dim = 0; dim < ImageDimension; dim++ )
                  {
                    if ( upper & 1 )
@@ -128,12 +129,14 @@ namespace clitk
                        neighIndex[dim] = baseIndex[dim];
                        overlap *= 1.0 - distance[dim];
                      }
+                    if (neighIndex[dim] < 0)
+                      neighbIndexSupZero = 0;
                    upper >>= 1;
                  }
 
                //JV shouldn't we verify that the index is not over the upper border instead of zero?
                // Set neighbor value only if overlap is not zero and index is still in image
-               if( overlap>0.0 && neighIndex[0]>=0 && neighIndex[1]>=0 && neighIndex[2]>=0 )
+               if ( overlap>0.0 && neighbIndexSupZero )
                  {
                    //what to store? the weighted displacement vector of Input2? 
                    totalDisplacement+=m_Input2->GetPixel(neighIndex)*overlap;
index 37a76d6..283abe6 100644 (file)
@@ -132,7 +132,7 @@ void HelperClass1<InputImageType, OutputImageType, DeformationFieldType>::Thread
 
   //Get pointer to the output
   typename OutputImageType::Pointer outputPtr = this->GetOutput();
-  typename OutputImageType::SizeType size=outputPtr->GetLargestPossibleRegion().GetSize();
+  //typename OutputImageType::SizeType size=outputPtr->GetLargestPossibleRegion().GetSize();
 
   //Iterators over input and deformation field
   typedef itk::ImageRegionConstIteratorWithIndex<InputImageType> InputImageIteratorType;
index 6bda75e..600775c 100644 (file)
@@ -119,7 +119,7 @@ void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const O
 
   //Get pointer to the output
   typename OutputImageType::Pointer outputPtr = this->GetOutput();
-  typename OutputImageType::SizeType size=outputPtr->GetLargestPossibleRegion().GetSize();
+  //typename OutputImageType::SizeType size=outputPtr->GetLargestPossibleRegion().GetSize();
 
   //Iterator over input
   typedef itk::ImageRegionConstIteratorWithIndex<InputImageType> InputImageIteratorType;
@@ -178,7 +178,7 @@ void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const O
         upper = counter;  // each bit indicates upper/lower neighbour
 
         // get neighbor index and overlap fraction
-        for( dim = 0; dim < 3; dim++ ) {
+        for( dim = 0; dim < ImageDimension; dim++ ) {
           if ( upper & 1 ) {
             neighIndex[dim] = baseIndex[dim] + 1;
             overlap *= distance[dim];
@@ -398,7 +398,6 @@ template <class InputImageType, class OutputImageType> void InvertVFFilter<Input
   typename OutputImageType::IndexType start;
   for (unsigned int i=0; i< ImageDimension; i++) start[i]=0;
   region.SetIndex(start);
-  PixelType zero = itk::NumericTraits<double>::Zero;
 
 
   //Allocate the weights
index 8313766..df12ea3 100644 (file)
@@ -101,8 +101,6 @@ void
 clitk::RelativePositionAnalyzerFilter<ImageType>::
 GenerateData() 
 {
-  static const unsigned int dim = ImageType::ImageDimension;
-  
   ImagePointer temp = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
   m_Object = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(1));
   m_Target = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(2));
index 1512e4c..9ae6dd9 100644 (file)
@@ -167,7 +167,6 @@ namespace clitk {
   std::vector<std::string> & RelativePositionDataBase::GetListOfPatients(const IndexType & index) const
   {
     const MapByPatientType & o = GetMapByPatient(index);
-    MapByPatientType::const_iterator iter = o.begin();
     std::vector<std::string> * v = new std::vector<std::string>; 
     MapToVecFirst(o, *v);
     return *v;
@@ -223,7 +222,7 @@ namespace clitk {
   bool RelativePositionDataBase::CheckIndex(const IndexType & index) const
   {
     try {
-      const RelativePositionInformationType & m =  GetInformation(index);
+      /*const RelativePositionInformationType & m = */ GetInformation(index);
     } catch (clitk::ExceptionObject e) {
       // std::cout << e.what() << std::endl;      
       return false;
index 28f3bd0..68d2a2b 100644 (file)
@@ -56,7 +56,7 @@ Update()
 
   // Loop over objects
   std::vector<double> m_ListOfThresholds;
-  for(int i=0; i<m_ListOfObjects.size(); i++) {
+  for(unsigned int i=0; i<m_ListOfObjects.size(); i++) {
     // DD(i);
     // DD(m_ListOfObjects[i]);
     // Set current index
@@ -66,7 +66,7 @@ Update()
     db.GetListOfDirections(GetStationName(), index.object, m_ListOfDirections);
     
     // Loop over direction
-    for(int j=0; j<m_ListOfDirections.size(); j++) {
+    for(unsigned int j=0; j<m_ListOfDirections.size(); j++) {
       // DD(j);
       // m_ListOfDirections[j].Println();
       // Set current index
@@ -106,7 +106,7 @@ ComputeOptimalThreshold(RelativePositionDataBaseIndexType & index, double & thre
 
   // For a given station, object, direction
   bool stop=false;
-  int i=0;
+  unsigned int i=0;
   if (index.direction.notFlag) threshold = 0.0;
   else threshold = 1.0;
   while (!stop && (i<ListOfPatients.size())) {
index af482ca..95a4e73 100644 (file)
@@ -85,7 +85,6 @@ clitk::RelativePositionDataBaseBuilderFilter<ImageType>::
 GenerateData() 
 {
   // Load database of anatomical elements
-  static const unsigned int dim = ImageType::ImageDimension;
   this->LoadAFDB();
 
   // Get some information
@@ -97,7 +96,7 @@ GenerateData()
 
   // Build the list of tested directions
   m_ListOfAngles.clear();
-  for(uint i=0; i<GetNumberOfAngles(); i++) {
+  for(int i=0; i<GetNumberOfAngles(); i++) {
     double a = i*360.0/GetNumberOfAngles();
     if (a>180) a = 180-a;
     m_ListOfAngles.push_back(clitk::deg2rad(a));
@@ -114,7 +113,7 @@ GenerateData()
   for (int i=0; i<GetNumberOfObjects(); i++) {
     m_Object = this->GetAFDB()->template GetImage <ImageType>(GetObjectName(i));
 
-    for (int j=0; j<m_ListOfDirections.size(); j++) {
+    for (unsigned int j=0; j<m_ListOfDirections.size(); j++) {
       clitk::RelativePositionDirectionType direction = m_ListOfDirections[j];
       
       // Create the filter
index 3f78b41..ca10c2d 100644 (file)
@@ -322,7 +322,6 @@ namespace clitk
       // The metric region with respect to the extracted transform region:
       // where should the metric be CALCULATED (depends on transform)
       typename FixedImageType::RegionType metricRegion = fixedImage->GetLargestPossibleRegion();
-      typename FixedImageType::RegionType::SizeType metricRegionSize=metricRegion.GetSize();
       typename FixedImageType::RegionType::IndexType metricRegionIndex=metricRegion.GetIndex();
       typename FixedImageType::PointType metricRegionOrigin=fixedImage->GetOrigin();
 
index ea10c73..a5db85a 100644 (file)
@@ -1058,7 +1058,6 @@ namespace clitk
     typename   CoefficientImageType::RegionType sourceRegion=m_PaddedCoefficientImage->GetLargestPossibleRegion();
     typename   CoefficientImageType::RegionType destinationRegion=m_PaddedCoefficientImage->GetLargestPossibleRegion();
     typename   CoefficientImageType::RegionType::SizeType sourceSize=sourceRegion.GetSize();
-    typename   CoefficientImageType::RegionType::SizeType destinationSize=destinationRegion.GetSize();    
     typename   CoefficientImageType::IndexType sourceIndex=sourceRegion.GetIndex();
     typename   CoefficientImageType::IndexType destinationIndex=destinationRegion.GetIndex();
  
index fa640a2..430d6a9 100644 (file)
@@ -33,7 +33,7 @@ ExtractStationSupports()
   
   // Read all support limits in a file and apply them
   ReadSupportLimits(GetSupportLimitsFilename());  
-  for(int i=0; i<m_ListOfSupportLimits.size(); i++) {
+  for(unsigned int i=0; i<m_ListOfSupportLimits.size(); i++) {
     SupportLimitsType s = m_ListOfSupportLimits[i];
     Support_SI_Limit(s.station_limit, s.station, s.structure_limit, 
                      s.structure, s.offset*m_Working_Support->GetSpacing()[2]);
index 68b81ee..98768b2 100644 (file)
@@ -205,10 +205,10 @@ CheckForStation(std::string station)
   // Check if station already exist in DB
   
   // FIXME -> do nothing if not on the command line. Is it what I want ?
-  bool found = false;
+  //bool found = false;
   if (this->GetAFDB()->TagExist(s)) {
     m_ListOfStations[station] = this->GetAFDB()->template GetImage<MaskImageType>(s);
-    found = true;
+    //found = true;
   }
 
 }
index 2eb3a02..8b380c8 100644 (file)
@@ -117,6 +117,7 @@ GenerateOutputInformation()
   // Define the images
   //---------------------------------
   ImagePointer m_input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
+  const unsigned int dim = ImageType::ImageDimension;
 
   //---------------------------------
   // Cast into internalimagetype
@@ -131,7 +132,7 @@ GenerateOutputInformation()
   // Compute the radius in pixel
   //---------------------------------
   if (m_RadiusInMMIsSet) {
-    for(uint i=0; i<ImageType::ImageDimension; i++) {
+    for(uint i=0; i<dim; i++) {
       m_Radius[i] = (uint)lrint(m_RadiusInMM[i]/input->GetSpacing()[i]);
     }
   }
@@ -145,7 +146,7 @@ GenerateOutputInformation()
     padFilter->SetInput(input);
     typename ImageType::SizeType lower;
     typename ImageType::SizeType upper;
-    for(uint i=0; i<3; i++) {
+    for(uint i=0; i<dim; i++) {
       lower[i] = upper[i] = 2*(m_Radius[i]+1);
     }
     padFilter->SetPadLowerBound(lower);
index 1562bea..3a3e0ab 100644 (file)
@@ -50,7 +50,7 @@ clitk::StructuresExtractionFilter<TImageType>::
 ApplyRelativePositionList(std::string name, MaskImageType * input) 
 { 
   // Create all RelativePositionList
-  for(int i=0; i<mListOfRelativePositionListFilename.size(); i++) {
+  for(unsigned int i=0; i<mListOfRelativePositionListFilename.size(); i++) {
     RelPosListPointer rpl = RelPosListType::New();
     rpl->SetAFDB(GetAFDB());
     rpl->Read(mListOfRelativePositionListFilename[i]);
index fac4b9c..d168869 100644 (file)
@@ -98,9 +98,8 @@ MedianImageGenericFilter<args_info_type>::UpdateWithInputImageType()
   typename MedianImageFilterType::Pointer thresholdFilter=MedianImageFilterType::New();
   thresholdFilter->SetInput(input);
 
-  indexRadius[0]=mArgsInfo.radius_arg[0];
-  indexRadius[1]=mArgsInfo.radius_arg[1];
-  indexRadius[2]=mArgsInfo.radius_arg[2];
+  for (unsigned i = 0; i < InputImageType::ImageDimension; ++i)
+    indexRadius[i]=mArgsInfo.radius_arg[i];
 
   // indexRadius[0] = 1;
   // indexRadius[1] = 1;
index 6ce6a2a..a6bba29 100644 (file)
@@ -67,7 +67,7 @@ SetOptionsFromArgsInfoToFilter(FilterType * f)
   f->SetAreaLossTolerance(mArgsInfo.tol_arg);
   f->SetSupportName(mArgsInfo.supportName_arg);
   f->SetTargetName(mArgsInfo.targetName_arg);
-  for(int i=0; i<mArgsInfo.objectName_given; i++)
+  for(unsigned int i=0; i<mArgsInfo.objectName_given; i++)
     f->AddObjectName(mArgsInfo.objectName_arg[i]);  
 }
 //--------------------------------------------------------------------