[Insight-users] `Image Memory Management

David Holmes holmesd3@yahoo.com
Wed, 11 Dec 2002 10:23:52 -0800 (PST)


Luis-

As expected, your modifications worked like a gem.  I
am very pleased.  The specific steps that I took were:

(1)  Add the three macro functions and a #define
DRH_HACK to the importimagecontainer.h

(2)  In my code, I put

T* out;
#ifdef DRH_HACK
in->GetPixelContainer()->SetContainerManageMemory(false)
out =in->GetPixelContainer()->GetImportPointer()
#else
out= (T*) malloc(W*H*D)
out = memcpy(out, (T *)in->GetBufferPointer(),W*H*D);	
	
#endif	
return out;


Like I said, it works  just as I want it and if I
distribute my code to other that don't have it, it
should also work.

But, that gets me to a more important question.  If
this is useful to other and it is added to the source,
then I would expect to see it in the development
version soon, however, when is the next scheduled
release of the static version that would possibly have
this?

Thanks

david


--- Luis Ibanez <luis.ibanez@kitware.com> wrote:
> Hi David,
> 
> It seem to be reasonable to set the
> boolean flag from the outside.
> 
> Could you please try something for us ?
> 
> add the following lines
> 
>    itkSetMacro(ContainerManageMemory);
>    itkGetMacro(ContainerManageMemory);
>    itkBooleanMacro(ContainerManageMemory);
> 
> to the file
> 
>       itkImportImageContainer.h
> 
> around line 112, where the Initialize() method
> is declared.
> 
> These line will generate the methods:
> 
>    void SetContainerManageMemory( bool );
>    bool GetContainerManageMemory();
>    ContainerManageMemoryOn();
>    ContainerManageMemoryOff();
> 
> In that way, you will have access to the boolean
> flag. Please make sure that you only alter the flag
> just before destroying the filter. Since the flag
> is internally set by the importer in various
> occasions,
> a premature setting of the flag may end up being
> overrided by the internal logic of the importer.
> 
> Please let us know if that helps to solve
> your problem.  If it does, we will include this
> on the repository.
> 
> 
>     Thanks
> 
> 
>      Luis
> 
> 
> BTW a comment about one of the options you mention:
> SetOutput() is not intendend to be called from the
> outside of filters. The filter makes a lot of
> internal
> preparations on the output images. Calling
> SetOuput()
> at the wrong time will clash with those
> preparations.
> 
>
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
>
http://public.kitware.com/mailman/listinfo/insight-users


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com