[vtkusers] Loading Images from Memory

Mathieu Bosi mathieu.bosi at gmail.com
Thu Mar 9 13:12:34 EST 2006


Yes, it's the case #2, I was already suspecting that ImageReaders could only
deal with file-system files...

Thanks for the advice :)

 - Mathieu -

2006/3/9, Mathieu Malaterre <mathieu.malaterre at kitware.com>:
>
> Salut Mathieu,
>
>         Two things:
>
> #1 If you are trying to load a memory buffer into a vtkImageData and
> this memory buffer is uncompressed and indeed contains something VTK can
> deal with (RBG values for instance). Then yes they are multiple way of
> doing so.
>
> #2. If you are looking for the API of the libpng to do memory file
> decompression, then this is not the right ML for that. I'd suggest
> posting to the libpng newsgroups or ML. The vtkPNGReader is only dealing
> with files.
>
> HTH
> Mathieu
>
> Mathieu Bosi wrote:
> > Hi to everyone, my name is Mathieu Bosi.
> >
> > I'm new to vtk and currently I'm facing with this Issue:
> > I have to load a geric image (i.e. PNG) from a compressed archive and
> > currently I'm able to extract the file to memory.
> > Is it actually possible to load an image from a "memory file"?
> >
> > More precisely I would like to achieve something like this:
> >
> > ----------------------------
> >
> > int size; // how many bytes we'll have in mem_ptr[]
> >
> > byte *mem_ptr = feedFromArchive( archive_file_name,
> > file_name_in_archive,   &size );
> >
> > vtkPNGReader  *png_reader  = vtkPNGReader::New();
> >
> > png_reader->SetMemFile( mem_ptr, size ); // <-- Versus --> the file
> > version:  png_reader->SetFileName( img_file_name );
> > png_reader->Update();
> >
> > ----------------------------
> >
> > Actually the only (rude) way I've found is to dump from the memory to a
> > temporary file and then passing that file name as a parameter to the
> > canonical "vtkPNGReader::SetFileName()" is that the only solution?
> >
> >
> > Thanks in advance for your kind attention
> >
> >  - Mathieu Bosi -
> >
> >
> >
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060309/5257394a/attachment.htm>


More information about the vtkusers mailing list