[Insight-users] a bug in ImportImageFilter?

Luis Ibanez luis . ibanez at kitware . com
Fri, 18 Jul 2003 16:11:34 -0400


Hi Carolyn,


Thanks for pointing this out.

You are right,

there is an inconsistency between the documentation
and the actual accion performed in the ImportImageFilter.

We could solve this by changing the documentation or by changing
the code. At this point it seems to be better for users, to fix
the documentation, since in this way we will not break applications
that are currently using this filter.


So the member variable name was changed from :

           m_SourceManageMemory

to:

           m_ThisImportImageFilterWillOwnTheMemory


The documentation of the SetImportPointer() method was modified
accordingly. The description on the SoftwareGuide was correct
though.


That certainly may have been the cause of the shift problem you
reported previously.  Our apologies for that.



Please let us know if you encounter further problems,



Thanks


    Luis



------------------------

Carolyn Johnston wrote:
> 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;
> }
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>