[Insight-developers] Fwd: Re: [Insight-users] Getting data in and out of ITK

William A. Hoffman bill.hoffman@kitware.com
Fri, 15 Feb 2002 09:09:08 -0500


--=====================_156123784==_
Content-Type: text/plain; charset="us-ascii"; format=flowed


>Date: Fri, 15 Feb 2002 14:29:02 +0100 (CET)
>From: Bjorn Hanch Sollie <bhs@pvv.org>
>X-X-Sender: bhs@verden.pvv.ntnu.no
>To: "William A. Hoffman" <bill.hoffman@kitware.com>
>Subject: Re: [Insight-users] Getting data in and out of ITK
>
> > Your code looks perfect, unfortunately ITK is not.  The Write on RawImageIO
> > is not yet implemented, but
> > will be soon.   For now try using  itk::RawImageWriter instead of
> > itk::ImageFileWriter, the only thing
> > you will have to change is tghe SetImageIO(write_io); line which should be
> > removed.
>
>OK, I'm using the RawImageWriter now, and I've removed the line you
>mention above, but unfortunately it still doesn't work properly.  I do
>get an output file of the exact same size as the input, but it
>contains only (binary) zeroes.  Leaving out the filter produces the
>same result, except the output file contains garbage instead.  (I've
>attatched my modified code should it be of any interest.)
>
>I've spent some time debugging the program, and it doesn't appear to
>start reading the file until I call write() at the very end (which
>doesn't seem right).  I'm sure it finds the file though, but there
>might be some problems with the reading (if it reads anything at all).
>
>(Also, I'm unable to resize or move the debug window I get with
>DebugOn().  Do you know any solutions to this?)
>
> > BTW, how long is "some time"?
>
>About two weeks.  Not only to write that snippet of code though; I
>compiled ITK for the first time last Monday and I had never used it
>prior to then.  I've spent a bit of time reading into the examples and
>some of the parts of the API that are relevant for my work.  Also,
>I've made an attempt at implementing my own read and write, however,
>my own methods work unsatisfactorily as well so far.  I believe the
>existing framework looks quite good though, and I'm sure ITK will be a
>great tool once all the pieces are fit into place.
>
>-Beorn
>--
>The History of the Universe
>Chapter 1: Bang!  Chapter 2: Sss...  Chapter 3: Crunch!
>The End

--=====================_156123784==_
Content-Type: application/octet-stream; name="MultiFilter1.cxx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="MultiFilter1.cxx"

I2luY2x1ZGUgIml0a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