[Insight-users] Re: RE: Re: Importing image data from a byte array
Chris Farmer
cfarmer at scitegic.com
Thu Sep 8 19:42:30 EDT 2005
Thanks, Luis.
I'd like to try to clarify something first here, though. (I feel like
I'm beating a dead horse with this topic!) Others have suggested these
tutorial topics, and I've looked at them already. I believe my issue
is that my data is encoded as PNG, and I somehow need to convert that
data into a raw format before I can effectively use the memory buffer in
itk. Is this correct?
Assuming this is correct...
I currently have virtually no experience with itk, so I'm not sure of
the best route to make this work. It looks like the PNGImageIO class
passes a file pointer into the underlying png library, but the png
library also seems to have the capability to accept a function pointer
to allow for a custom data reading function. I thought it might be
possible to write a new ImageSource class to handle this with the memory
buffer. Or modify the PNGImageIO to handle both file sources and
in-memory sources. I'd like to be able to handle quite a few encoded
formats, so it looks like modifying PNGImageIO and other formats might
be the way to go. Do you have any opinions on this?
Thanks,
Chris
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Thursday, September 08, 2005 4:19 PM
To: Chris Farmer
Cc: Brian Eastwood; insight-users at itk.org
Subject: Re: [Insight-users] Re: RE: Re: Importing image data from a
byte array
Hi Chris,
Please read the ITK Tutorials
http://www.itk.org/HTML/Tutorials.htm
in particular
"Getting Started V: Integrating ITK in your Application"
http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf
This tutorial describes multiple strategies for passing data
between an ITK image and a byte array to and from your
application.
Some examples on this issue are also presented in the ITK
Software Guide
http://www.itk.org/ItkSoftwareGuide.pdf
in the "Data Representation" chapter.
They will show you how to use the existing buffers in memory
and use them to build ITK images without having to duplicate
the data.
Regards,
Luis
------------------
Chris Farmer wrote:
>
> Hi Brian,
> Thanks for the reply. I understand that the PNG (or whatever other)
> data that I read in will no longer be specifically PNG. I am happy
with
> that. My only issue is that my application already has *in-memory*
> buffers representing image data in the PNG format. I might be dealing
> with thousands of these. It's not clear exactly what I might have to
do
> with these images at the moment, but let's just assume for now that I
> have the simple task of changing the image's format from PNG into TIF.
>>From the examples in the itk source distribution, it appears that I
> should use the ImageFileReader and ImageFileWriter and set the
> appropriate filenames with extensions to read my PNG data and output
TIF
> data. In my current application, this would mean that I have to write
> out my buffer to a file solely to have it read back in by the
> ImageFileReader (ultimately the PNGImageIO::Read method). All I want
to
> do is avoid this step of writing a file. I basically want the logic
> that's within the Read method without the requirement that the data
> source be a file.
>
>
>
> Thanks,
> Chris
>
>
>
>
>
>
> -----Original Message-----
> From: Brian Eastwood [mailto:beastwoo at email.unc.edu]
> Sent: Wednesday, September 07, 2005 5:49 PM
> To: insight-users at itk.org
> Subject: [Insight-users] Re: RE: Re: Importing image data from a byte
> array
>
> Hi Chris,
>
> Once you have loaded image data through one of ITK's readers into an
> itk::Image object, it is no longer specifically PNG data--it's just
> image data. For example, you could do all sorts of processing of the
> data using an ITK pipeline; you could grab the image data at any point
> in the pipeline and display it (e.g. using Qt or VTK); you could
> transfer the data buffer to another image library format and do
> something there--for example, ImageMagick. For all of this, there is
no
>
> need to write intermediary image data to disk. Maybe you can mention
a
> bit more about what your application is supposed to do, and it's
likely
> someone on the list has done something similar, or would know the
> components to tie together.
>
> Cheers,
> Brian
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
--
Click on the link below to report this email as spam
https://www.mailcontrol.com/sr/MFNUc0RrTh5pbXSbvmHOb+igJpkjbiFjUb6iDJYD!
f+bldtdMK7nyzWeSvroNZC3CTGOfIKdSoC46APJ3nM2GgGBGIbHCAcCSDwKi79A4gJicwC7o
qP6vw+gMm2JSoHR1!iTDQThAi8ztQhe0ssARRyq36LeILlkZlbWBfOxfUc7+UC!tMUbCY!H2
JZIxh!84j2LX8VcgjAbCnFw7IqCX+J4u9Ekoi!I
More information about the Insight-users
mailing list