How do I read RAW files with SimpleITK for C#?
I use SimpleITK C# version 0.5.1 on Windows (64 bit)
My code is:
String fileName = @"d:\Temp\MRI\t1_icbm_normal_1mm_pn3_rf20.rawb";
ImageFileReader reader = new ImageFileReader();
reader.SetFileName(fileName);
Image image = reader.Execute();
It works fine for .png or analyze images for example but not for RAW images.
I get the following error:
System.ApplicationException : Exception thrown in SimpleITK ImageFileReader_Execute: ..\\..\\..\\..\\..\SimpleITK\Code\IO\src\sitkImageReaderBase.cxx:44:
sitk::ERROR: Unable to determine ImageIO reader for "d:\Temp\MRI\t1_icbm_normal_1mm_pn3_rf20.rawb"
I understand that the ImageFileReader cannot recognize the file type.
Is there a way of passing the image type and image parameters in SimpleITK since the standard ITK templates are hidden?
Thanks to Insight-Users group I got some clues to solve this issue.
The problem is that ImageFileReader cannot read RAW files. The solution is to read binary data manualy and use ImportImageFilter to build the Image object. The code is as follows: