[Insight-users] ITK 3.2 png read/write problem
robert tamburo
robert.tamburo at gmail.com
Wed Mar 16 09:30:58 EDT 2011
Code looks fine to me. Could be some pixel type issues. Try putting the
Update calls in try/catch blocks to catch any exceptions.
On Wed, Mar 16, 2011 at 8:47 AM, David Doria <daviddoria at gmail.com> wrote:
> I recently switched to ITK 3.2 while waiting for some problems with master
> to be resolved. With this very simple example, 3.2 seems to produce an all
> black image, where I would expect the output to be the same as the input (at
> least the first channel). There are no errors or warnings. Are there any
> known problems with this?
>
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
>
> int main(int argc, char *argv[])
> {
> if(argc < 2)
> {
> std::cerr << "Required: filename" << std::endl;
>
> return EXIT_FAILURE;
> }
> std::string inputFilename = argv[1];
>
> typedef itk::Image< unsigned char, 2 > ImageType;
>
> typedef itk::ImageFileReader<ImageType> ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName(inputFilename.c_str());
> reader->Update();
>
> typedef itk::ImageFileWriter<ImageType> WriterType;
> WriterType::Pointer writer = WriterType::New();
> writer->SetInput(reader->GetOutput());
> writer->SetFileName("output.png");
> writer->Update();
>
> return EXIT_SUCCESS;
> }
>
> Thanks,
>
> David
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110316/538d1324/attachment.htm>
More information about the Insight-users
mailing list