[Insight-users] userPromiseToDeleteTheBuffer

Miller, James V (Research) millerjv at crd . ge . com
Fri, 6 Jun 2003 13:24:03 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C32C4F.FDF436E1
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

>From the header file of ImportImageFilter (which is the only truth)
=20
  /** 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.
=20
So I am guessing we may have it backwards in the Software Guide.
=20
=20

-----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=F3n de la Tierra, Teledetecci=F3n y =
Aeronom=EDa
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>   =20
=20
=20


------_=_NextPart_001_01C32C4F.FDF436E1
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff size=3D2>From=20
the header file of ImportImageFilter (which is the only=20
truth)</FONT></SPAN></DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff size=3D2>&nbsp;=20
/** Set the pointer from which the image data is imported.&nbsp; "num"=20
is<BR>&nbsp;&nbsp; * the number of pixels in the block of memory.=20
If<BR>&nbsp;&nbsp; * "LetSourceManageMemory" is false, then the =
application=20
retains<BR>&nbsp;&nbsp; * the responsibility of freeing the memory for =
this=20
image data.&nbsp; If<BR>&nbsp;&nbsp; * "LetSourceManageMemory" is true, =
then=20
this class will free the<BR>&nbsp;&nbsp; * memory when this object is =
destroyed.=20
*/<BR>&nbsp; void SetImportPointer(TPixel *ptr, unsigned long=20
num,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
bool LetSourceManageMemory);<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff size=3D2>So a=20
value of "true" means the ImportImageFilter will delete the =
memory.&nbsp; A=20
value of "false" means the application is responsible for deleting the=20
memory.</FONT></SPAN></DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff size=3D2>So I=20
am guessing we may have it backwards in the Software =
Guide.</FONT></SPAN></DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D395542017-06062003><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>&nbsp;</DIV></FONT></SPAN>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Severino =
Fernandez=20
  [mailto:severinofer at recol . es]<BR><B>Sent:</B> Friday, June 06, 2003 =
7:04=20
  AM<BR><B>To:</B> insight-users at public . kitware . com<BR><B>Subject:</B>=20
  [Insight-users] userPromiseToDeleteTheBuffer<BR><BR></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>I call ITK C++ code from a C =
program. The C=20
  program passes buffers with image data to the static library =
generated using=20
  ITK code.&nbsp; I import these buffers using <FONT face=3DCourier=20
  size=3D2>ImportImageFilter</FONT><FONT face=3D"Times New Roman"=20
  size=3D2>.</FONT></FONT></DIV>
  <DIV><FONT size=3D2><FONT face=3DArial>As I understand from the=20
  Software&nbsp;Guide&nbsp; the <FONT size=3D1><FONT size=3D2><FONT=20
  face=3DCourier>userPromiseToDeleteTheBuffer</FONT> argument to the =
<FONT=20
  face=3DCourier>SetImportPointer</FONT> method should be&nbsp; <FONT=20
  face=3DCourier>true</FONT>, in order for the <FONT=20
  face=3DCourier>ImportImageFilter</FONT>&nbsp; not to try to delete =
the passed=20
  buffer.</FONT></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Taking this approach, the code will =
fail when the=20
  C++ code using the ITK&nbsp;classes exits. On the contrary, if I set =
the value=20
  to <FONT face=3DCourier>false, </FONT><FONT face=3DArial>it seems to =
work OK and I=20
  can retrieve the values in the buffers from the C =
program.</FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>It seems that I am misuderstanding =
the text of=20
  the Software Guide&nbsp;or I do not undersand some part of the=20
  mechanisms,&nbsp; or that there is some inconsistency in the Software =

  Guide.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Could someone give a short comment =
on this=20
  ?</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Severino Fernandez<BR>Instituto =
Nacional de=20
  Tecnica Aeroespacial<BR>Departamento de Observaci=F3n de la Tierra,=20
  Teledetecci=F3n y Aeronom=EDa<BR>Carretera de Ajalvir, Km 4<BR>28850 =
Torrejon de=20
  Ardoz<BR>Spain<BR>Tel&nbsp;&nbsp; +34 91 648 78=20
  00<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +34 91 305 16=20
  52<BR>Fax&nbsp;&nbsp; +34 91 677 46 46<BR>Email <A=20
  =
href=3D"mailto:severinofer at recol . es">severinofer at recol . es</A>&nbsp;&nbsp=
;=20
  </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C32C4F.FDF436E1--