[Insight-developers] PNGIO problem
mark foskey
Mark Foskey <foskey at cs . unc . edu>
Fri, 02 Aug 2002 10:14:03 -0400
It seems that ImageIOFactory::CreateImageIO(const char* path) makes sure
that it can read "path" before returning the IO object. This is fine if
you are interested in input, but it doesn't work so well for output. Am
I doing something wrong?
An example is the following try block. I get an error on output because
a writer is not generated, and generation fails because the output file
(which doesn't exist yet) can't be read.
try
{
// Enable reading and writing of PNG files.
itk::PNGImageIOFactory::RegisterOneFactory();
// . . . read and process the file . . .
// Instantiate a writer and attach it to the filter.
typedef itk::ImageFileWriter<ImageType> ImageWriterType;
ImageWriterType::Pointer writer = ImageWriterType::New();
writer->SetInput(myFilter->GetOutput());
writer->SetFileName(argv[2]);
// Execute the process.
writer->Write();
}
catch(itk::ExceptionObject &err)
{
std::cerr << err << std::endl;
return 1;
}
--
Mark Foskey (919) 843-5436 Computer-Aided Diagnosis and Display Lab
mark_foskey@unc.edu Department of Radiology, CB 7515, UNC
http://www.cs.unc.edu/~foskey Chapel Hill, NC 27599-7515
---
You are currently subscribed to caddlab-internal as: foskey@cs.unc.edu
To unsubscribe send a blank email to
leave-caddlab-internal-1349718V@listserv.unc.edu