I built the example RGBImageReadWrite.cxx using CMake config generate with CMakeLists.txt and source file for the example and generate bin and built that in vs2017… so far so good, but when I run this example with following command line and arguments it crashes in Writer->Update() line in the source file above!?
RGBImageReadWrite.exe BrainMidSagittalSlice.png BrainMidSagittalSlice.rgb
I read the ITK book about using IO architecture and that it does not matter what is the input file the output file will be RGB for this example, am I write or wrong? according to book everything is delegated in different class under itk::ImageIO class and itk::ImageIOFactory so what would be wrong that on call to writer->Update() program crashes? should I change the input file types?
I don’t think
.rgb extension is associated with a supported file format. Try naming your output with a
To get an error message, wrap your
Writer->Update(); line or entire source code in a try-catch block.
I did use try-catch pair and it did give me a message that you should use a supported format such as PNGImageIO or JPEGImageIO etc. I did give an input file with png format but 2d and it worked! thanks!
one more question how to open [.mha + raw] file. I don’t know how these two combination would work? how to read them with itk::ImageFileReader or write with itk::ImageFileWriter? any great idea?
The usual combination is .mhd+.raw, but .mha+.raw might work too if .mha file references .raw file.
When writing, .mhd indicates user’s desire to have a header+raw file, and .mha indicates a desire for combined single (“archive”?) file.
I worked you are right just .mhd + .raw files will suffice to get the results out. Thanks