[vtkusers] Running out of file handles

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Mon Aug 19 04:42:50 EDT 2002


I noticed the other day that if you use a vtkBMPReader to load a file, the file is left open for the entire lifetime of the vtkBMPreader. I don't know if this is deliberate (so that you can tell when a file is changed and reload) or a bug. But if the same applies to a tiffreader, then your max files problem will manifest.

loop over all 80
 If you vtkTiffReader->Update()
 then 
 mytiff[loop] = vtkTiffReader->GetOutput();
 mytiff[loop]->Register(NULL);
 vtkTiffReader->UnregisterAllOutputs()
 vtkTiffReader->Delete()
end loop

the files should be closed after each read and you won't get the trouble.

However, TiffReader does descend from ImageReader so why don't you just load all 80 into a single volume using a single TiffReader...

JB
 


----- Original Message ----- 
From: <David.Pont at ForestResearch.co.nz>
To: <vtkusers at public.kitware.com>
Sent: Sunday, August 18, 2002 11:11 PM
Subject: [vtkusers] Running out of file handles


> 
> I am loading about 80 images from TIFF files, one vtkTIFFReader per image,
> and I get an error after the maximum number of file handles is reached. I
> am using Borland C++ Builder, which defines FOPEN_MAX 50. The images are of
> cross sections cut from a tree, so form a kind of volume, with irregular
> spacing.
> I am more used to working with polydata, so images and volumes are new to
> me. Does anyone have any tips on how to circumvent the limit on file
> handles. I tried vtkTIFFReader->SetReleaseDataFlag( 1 ), Update, with no
> change. Should I name/number the files to allow the TIFFReader to load them
> as a sequence, or will the limit still apply? Or can I create a volume out
> of the images in the first place and load that, although I think the
> irregular spacing will be a problem with any volume based approach.
> 
>   regards
>      Dave Pont
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers




More information about the vtkusers mailing list