[vtkusers] Running out of file handles

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Wed Aug 21 17:12:16 EDT 2002


John,
  Thanks a lot for the info, I finally got past this problem. In fact I am
running with vtk 3.1 (legacy app that I dont want to disturb) and
UnregisterAllOutputs is not available. Further, after peeking at the latest
code from the vtk CVS, I could not figure out how to get the same effect in
3.1 with public methods.
So I connected my TIFFReader to a temp instance of vtkImageData, called
Update, then copied its contents 'manually' (DeepCopy with some other bits)
to a permanent vtkImageData (one per image) which acts as the start of my
official pipeline. This effectively disconnected the TIFFReader from the
pipeline, allowing me to delete it after input. Maybe there is a smarter
way? I still dont fully understand all the workings of reference counting,
although I learnt a bit more.
I am not sure if using a volume approach would help with the file handle
issue? Also, as my slices are not of regular spacing or size, and require
individual transformations (rotation, translation) the only benefit of a
volume (apart from one-shot input) would be as a handy 'array' for my set
of slices. Still it is food for thought, I have never worked with volumes
so that limits my ability to see how they could be useful... wheres my vtk
book....

Thanks again
    Dave Pont



|--------+---------------------------------->
|        |          "John Biddiscombe"      |
|        |          <jbiddiscombe at skippingmo|
|        |          use.co.uk>              |
|        |          Sent by:                |
|        |          vtkusers-admin at public.ki|
|        |          tware.com               |
|        |                                  |
|        |                                  |
|        |          19/08/2002 20:42        |
|        |          Please respond to "John |
|        |          Biddiscombe"            |
|        |                                  |
|--------+---------------------------------->
  >------------------------------------------------------------------------------------------------------------|
  |                                                                                                            |
  |      To:     <vtkusers at public.kitware.com>, <David.Pont at forestresearch.co.nz>                              |
  |      cc:                                                                                                   |
  |      Subject:     Re: [vtkusers] Running out of file handles                                               |
  >------------------------------------------------------------------------------------------------------------|




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

_______________________________________________
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