[ITK] SimpleITK in R: Best way to read image

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Nov 3 15:50:25 EST 2014


Hello,

I haven't use the R interface much. I have two suggestions:

1) Did you try manually calling the R garbage collector? [1]
2) If you comment out the imArray conversion do you still get the "leak"? ( This is to narrow down the cause of 1 doesn't address the issue)

Brad


[1] http://stat.ethz.ch/R-manual/R-patched/library/base/html/gc.html

On Nov 3, 2014, at 3:43 PM, Ryan Edward Young <Ryan.E.Young at Colorado.EDU> wrote:

> Hello,
> 
> A am trying to read several nifti files into R as follows.
> 
> for(i in 1:n){
>      im=ReadImage(image.nii.gz)
>      imArray=as.array(im)
>      #compare image with other images, and add the similar part to an array
> }
> 
> When I do this the memory usage just keeps growing.  It appears that simpleITK is not doing any garbage collection when I open a new image into my im variable.  Is there a command to close itk connection to a image or clear that part of the buffer?  Any advice is appreciated.
> 
> Thanks
> Ryan
> 
> 
>      
> 
> 
> 
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community



More information about the Community mailing list