[Insight-users] Getting data in and out of ITK

Bjorn Hanch Sollie bhs@pvv.org
Thu, 14 Feb 2002 18:52:37 +0100 (CET)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-1594614666-1013709157=:70451
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hello to you all,

I have been struggling for some time now trying to get 3D raw image
data in and out of ITK.  Basically what I wish to do is this:

read data into buffer -> filters -> write output buffer to disk

or in other words:

Read data, filter calls reader->GetOutput(), another filter calls
filter->GetOutput() etc., writer calls filter->GetOutput(), write
data.

I've studied the examples, but unfortunately I have so far been unable
to use the techniques they provide to fit my own needs and actually
produce meaningful output.  (Yes, I'm aware that there are minor
hitches, such as, for example, that some filters require data of
certain types.)

I have attached a simple sample program (it's just short over 50
lines) that attempts to just read some image data into a buffer, ready
to be accessed by a filter and write the processed data back to disk,
the present problem being that it doesn't produce any output at all.

I will be most grateful if any one of you are willing to bear with me,
take a look at it and give me some hints as to what I need to
do/change in order to make it work accoding to my wishes.

-Beorn
-- 
The History of the Universe
Chapter 1: Bang!  Chapter 2: Sss...  Chapter 3: Crunch!
The End

--0-1594614666-1013709157=:70451
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="MultiFilter.cxx"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.40.0202141852370.70451@verden.pvv.ntnu.no>
Content-Description: 
Content-Disposition: attachment; filename="MultiFilter.cxx"

I2luY2x1ZGUgIml0a1Jhd0ltYWdlSU8uaCINCiNpbmNsdWRlICJpdGtJbWFn
ZUZpbGVSZWFkZXIuaCINCiNpbmNsdWRlICJpdGtJbWFnZUZpbGVXcml0ZXIu
aCINCiNpbmNsdWRlICJpdGtSYXdJbWFnZVdyaXRlci5oIg0KI2luY2x1ZGUg
Iml0a0dyYWRpZW50TWFnbml0dWRlSW1hZ2VGaWx0ZXIuaCINCg0KDQp0eXBl
ZGVmIGl0azo6SW1hZ2U8d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