[Insight-users] a bug in ImportImageFilter?

Carolyn Johnston Carolyn . Johnston at vexcel . com
Fri, 18 Jul 2003 13:21:20 -0600


Could there be a bug in SetImportPointer? I noted while debugging that 
although passing the value LetSourceManageMemory = true is supposed to, 
well, allow the source to manage the memory according to the manual, delete 
is called on the import pointer if m_SourceManageMemory == true, and 
stepping through the code I note m_SourceManageMemory is reset to 
LetSourceManageMemory (code snippet included). I note also that the 
destructor deletes the memory if m_SourceManageMemory is true.

I thought it was possible this is a bug that slipped through testing, since 
this may be a part of ITK that isn't used as frequently as the standard 
image readers. This is apparently what was causing the shift problem I 
posted a couple of days ago.

:) Carolyn

________________________________________________________________________________________
ImportImageFilter<TPixel, VImageDimension>
::SetImportPointer(TPixel *ptr, unsigned long num, bool LetSourceManageMemory)
{
   if (ptr != m_ImportPointer)
     {
     if (m_ImportPointer && m_SourceManageMemory)
       {
       delete [] m_ImportPointer;
       }
     m_ImportPointer = ptr;
     this->Modified();
     }
   m_SourceManageMemory = ;
   m_Size = num;
}