]> Creatis software - clitk.git/commitdiff
debugging messages
authorRomulo Pinho <pinho@lyon.fnclcc.fr>
Mon, 30 May 2011 12:48:16 +0000 (14:48 +0200)
committerRomulo Pinho <pinho@lyon.fnclcc.fr>
Mon, 30 May 2011 12:48:16 +0000 (14:48 +0200)
registration/clitkGenericMetric.txx

index 6f10e72a1ee1e04744927727c70dbfe31b800056..b5df490d70c64c75986609cde2b134dae33ee6de 100644 (file)
@@ -256,11 +256,15 @@ GenericMetric<args_info_type,FixedImageType, MovingImageType>::GetMetricPointer(
   }
 
 
-  //typedef itk::ImageMaskSpatialObject<itkGetStaticConstMacro(FixedImageDimension)> ImageMaskSpatialObjectType;
-  //typename ImageMaskSpatialObjectType::ConstPointer mask = dynamic_cast<const ImageMaskSpatialObjectType*>(m_FixedImageMask.GetPointer());
+  typedef itk::ImageMaskSpatialObject<itkGetStaticConstMacro(FixedImageDimension)> ImageMaskSpatialObjectType;
+  typename ImageMaskSpatialObjectType::ConstPointer mask = NULL;
+  if (m_FixedImageMask.IsNotNull())
+    mask = dynamic_cast<const ImageMaskSpatialObjectType*>(m_FixedImageMask.GetPointer());
 
-  //typedef typename ImageMaskSpatialObjectType::RegionType ImageMaskRegionType;
-  //ImageMaskRegionType mask_region = mask->GetAxisAlignedBoundingBoxRegion();
+  typedef typename ImageMaskSpatialObjectType::RegionType ImageMaskRegionType;
+  ImageMaskRegionType mask_region;
+  if (mask.IsNotNull())
+    mask_region = mask->GetAxisAlignedBoundingBoxRegion();
 
   // Common properties
   if( m_FixedImageMask.IsNotNull() )
@@ -300,7 +304,7 @@ GenericMetric<args_info_type,FixedImageType, MovingImageType>::GetMetricPointer(
 
     // Calculate the number
     const unsigned int totalNumberOfPixels = m_FixedImageRegion.GetNumberOfPixels();
-    //const unsigned int totalNumberOfPixels = mask_region.GetNumberOfPixels();
+    const unsigned int totalNumberOfMaskPixels = mask_region.GetNumberOfPixels();
     const unsigned int numberOfDemandedPixels =  static_cast< unsigned int >( (double) totalNumberOfPixels *m_ArgsInfo.samples_arg );
 
     // --------------------------------------------------
@@ -359,7 +363,7 @@ GenericMetric<args_info_type,FixedImageType, MovingImageType>::GetMetricPointer(
       //RandomIterator randIter( m_FixedImage, mask_region );
       
       if (m_Verbose) std::cout << "Search region " << m_FixedImageRegion << std::endl;
-      //if (m_Verbose) std::cout << "Mask search region " << mask_region << std::endl;
+      if (m_Verbose) std::cout << "Mask search region " << mask_region << std::endl;
 
       // Randomly sample the image
       short att = 1;
@@ -427,6 +431,7 @@ GenericMetric<args_info_type,FixedImageType, MovingImageType>::GetMetricPointer(
     if (m_Verbose) std::cout<<"A fraction of "<<m_ArgsInfo.samples_arg<<" spatial samples was requested..."<<std::endl;
     double fraction=(double)numberOfValidPixels/ (double) totalNumberOfPixels;
     if (m_Verbose) std::cout<<"Found "<<numberOfValidPixels <<" valid pixels for a total of "<<totalNumberOfPixels<<" (a fraction of "<<fraction<<")..."<<std::endl;
+    if (m_Verbose) std::cout<<"number of mask pixels "<<totalNumberOfMaskPixels<<std::endl;
 
   }