[Insight-users] userPromiseToDeleteTheBuffer

Luis Ibanez luis . ibanez at kitware . com
Sat, 07 Jun 2003 10:49:26 -0400


Severino, Jim,

Thanks for pointing this out.

It was actually an error in the SoftwareGuide. The section
in question has been fixed and a fresh PDF version is now
available at the usual address

       http://www . itk . org/ItkSoftwareGuide . pdf



Regards,


    Luis


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

Miller, James V (Research) wrote:
>  From the header file of ImportImageFilter (which is the only truth)
>  
>   /** Set the pointer from which the image data is imported.  "num" is
>    * the number of pixels in the block of memory. If
>    * "LetSourceManageMemory" is false, then the application retains
>    * the responsibility of freeing the memory for this image data.  If
>    * "LetSourceManageMemory" is true, then this class will free the
>    * memory when this object is destroyed. */
>   void SetImportPointer(TPixel *ptr, unsigned long num,
>                         bool LetSourceManageMemory);
> So a value of "true" means the ImportImageFilter will delete the 
> memory.  A value of "false" means the application is responsible for 
> deleting the memory.
>  
> So I am guessing we may have it backwards in the Software Guide.
>  
>  
> 
>     -----Original Message-----
>     *From:* Severino Fernandez [mailto:severinofer at recol . es]
>     *Sent:* Friday, June 06, 2003 7:04 AM
>     *To:* insight-users at public . kitware . com
>     *Subject:* [Insight-users] userPromiseToDeleteTheBuffer
> 
>     I call ITK C++ code from a C program. The C program passes buffers
>     with image data to the static library generated using ITK code.  I
>     import these buffers using ImportImageFilter.
>     As I understand from the Software Guide  the
>     userPromiseToDeleteTheBuffer argument to the SetImportPointer method
>     should be  true, in order for the ImportImageFilter  not to try to
>     delete the passed buffer.
>     Taking this approach, the code will fail when the C++ code using the
>     ITK classes exits. On the contrary, if I set the value to false, it
>     seems to work OK and I can retrieve the values in the buffers from
>     the C program.
>     It seems that I am misuderstanding the text of the Software Guide or
>     I do not undersand some part of the mechanisms,  or that there is
>     some inconsistency in the Software Guide.
>     Could someone give a short comment on this ?
>     Severino Fernandez
>     Instituto Nacional de Tecnica Aeroespacial
>     Departamento de Observación de la Tierra, Teledetección y Aeronomía
>     Carretera de Ajalvir, Km 4
>     28850 Torrejon de Ardoz
>     Spain
>     Tel   +34 91 648 78 00
>             +34 91 305 16 52
>     Fax   +34 91 677 46 46
>     Email severinofer at recol . es <mailto:severinofer at recol . es>  
>      
>      
>