Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkProgressReporter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkProgressReporter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/02/19 18:30:25 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef _itkProgressReporter_h
00018 #define _itkProgressReporter_h
00019 
00020 #include "itkProcessObject.h"
00021 
00022 namespace itk
00023 {
00024 
00058 class ProgressReporter
00059 {
00060 public:
00062   ProgressReporter(ProcessObject* filter, int threadId,
00063                    unsigned long numberOfPixels,
00064                    unsigned long numberOfUpdates = 100);
00065   
00067   ~ProgressReporter();
00068   
00070   void CompletedPixel()
00071     {
00072     // Inline implementation for efficiency.
00073     // We don't need to test for thread id 0 here because the
00074     // constructor sets m_PixelsBeforeUpdate to a value larger than
00075     // the number of pixels for threads other than 0.
00076     if(--m_PixelsBeforeUpdate == 0)
00077       {
00078       m_PixelsBeforeUpdate = m_PixelsPerUpdate;
00079       m_CurrentPixel += m_PixelsPerUpdate;
00080       m_Filter->UpdateProgress(m_CurrentPixel * m_InverseNumberOfPixels);
00081       }
00082     }
00083 protected:
00084   ProcessObject* m_Filter;
00085   int m_ThreadId;
00086   float m_InverseNumberOfPixels;
00087   unsigned long m_CurrentPixel;
00088   unsigned long m_PixelsPerUpdate;
00089   unsigned long m_PixelsBeforeUpdate;
00090 };
00091 
00092 } // end namespace itk
00093 
00094 #endif

Generated at Fri May 21 01:15:13 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000