[ITK] getting RawImageIO to work

Bradley Lowekamp brad at lowekamp.net
Sat Jan 3 09:35:18 EST 2015


Hello,

You need to set everything for the inageio to know it.  The is a complicated example but hopefully it'll be helpful. 

http://itk.org/Insight/Doxygen/html/Examples_2IO_2VisibleHumanStreamReadWrite_8cxx-example.html

I generally recommend writing a metadata mhd header file. 

http://www.itk.org/Wiki/MetaIO/Documentation#Reading_a_Brick-of-Bytes_.28an_N-Dimensional_volume_in_a_single_file.29

Brad



> On Jan 3, 2015, at 7:33 AM, Ronn Kling <ronn at rlkling.com> wrote:
> 
> Does anyone have a clue on how to fix this?
> 
>> On 12/24/2014 2:26 PM, Ronn Kling wrote:
>> I am using ITK 4.6.1, VS2010 and windows 7 64 bit. It gives this error on the last line in the try box
>> 
>> <mime-attachment.png>
>> 
>> #include <stdlib.h>
>> #include <string.h>
>> #include <stdio.h>
>> #include <iostream>
>> #include <fstream>
>> #include <afxwinforms.h>
>> 
>> #include "itkRawImageIO.h"
>> #include "itkImageFileReader.h"
>> #include "itkImageFileWriter.h"
>> 
>> #using <mscorlib.dll>
>> 
>> using namespace System;
>> using namespace System::IO;
>> using namespace System::Windows::Forms;
>> using namespace System::Drawing;
>> using namespace System::Collections;
>> using namespace System::Runtime::InteropServices;
>> 
>> 
>> int main()
>> 
>> {
>> 
>>     
>> try {
>>           typedef unsigned char fixedPixelType;
>>           typedef unsigned char movingPixelType;
>> 
>>           typedef itk::Image<fixedPixelType, 3>     fixedImageType;
>>           typedef itk::Image<movingPixelType, 3>           movingImageType;
>>           // create a ImageIO for the raw data files
>>           typedef itk::RawImageIO<fixedPixelType, 2> ImageIOType;
>>           ImageIOType::Pointer fixedimageio = ImageIOType::New();
>> 
>> 
>>       
>> } catch(itk::ExceptionObject & err)
>> 
>>         {std::cerr << "itkWrapper caught an ITK exception:\n";
>>         err.Print(std::cerr);
>>     }
>> }
>>> On 12/24/2014 2:07 PM, Bill Lorensen wrote:
>>> Please provide a small, complete compilable example and I'm sure we can help.
>>> 
>>> 
>>> On Wed, Dec 24, 2014 at 1:14 PM, Ronn Kling <ronn at rlkling.com> wrote:
>>>> Hello All,
>>>> 
>>>> I am trying to read in a binary data file using RawImageIO.  When I step
>>>> through with the debugger I get an error on the last line below about memory
>>>> corruption. As far as I can tell I have everything correct, what am I
>>>> missing?
>>>> 
>>>>           typedef unsigned char fixedPixelType;
>>>>           typedef unsigned char movingPixelType;
>>>> 
>>>>           typedef itk::Image<fixedPixelType, 3> fixedImageType;
>>>>           typedef itk::Image<movingPixelType, 3> movingImageType;
>>>>           // create a ImageIO for the raw data files
>>>>           typedef itk::RawImageIO<fixedPixelType, 2> ImageIOType;
>>>>           ImageIOType::Pointer fixedimageio = ImageIOType::New();
>>>> _______________________________________________
>>>> Community mailing list
>>>> Community at itk.org
>>>> http://public.kitware.com/mailman/listinfo/community
>> 
>> 
>> 
>> _______________________________________________
>> Community mailing list
>> Community at itk.org
>> http://public.kitware.com/mailman/listinfo/community
> 
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150103/efa36fd0/attachment.html>


More information about the Community mailing list