[Insight-users] ERROR: GDCMImageIO: could not open file...for writing

verenas at uni-koblenz.de verenas at uni-koblenz.de
Thu Jan 11 11:09:00 EST 2007


Hi,

there is a strange error "ERROR: GDCMImageIO: could not open file xx for
writing". Reasion: Permission denied. itkGDCMImageIO.cxx Line: 161

I'm reading a serie of DICOM images. SubsampleVolume changes the
resolution and NumericSeriesFileNames generates as much as names as my new
serie needs. Everything works fine.

How could that be, that I do not have permission to write my self
generated first slice of the new volume? There are no problems with the
folder i wanted to write in...

thx,
verena

typedef itk::NumericSeriesFileNames Generator;
Generator::Pointer nameGen = Generator::New();

InputImageType::IndexType index =
resampler->GetOutput()->GetLargestPossibleRegion().GetIndex();

InputImageType::IndexType size =
resampler->GetOutput()->GetLargestPossibleRegion().GetSize();

nameGen->SetStartIndex(index[2]);
nameGen->SetEndIndex(index[2] + size[2] -1);
nameGen->SetIncrementIndex(1);

std::string outputNames = argv[3];

outputNames += "%d.dcm";

nameGen->SetSeriesFormat(outputNames.c_str());

typedef itk::Image< OutputPixelType, 2 > WriterImageType;

typedef itk::ImageSeriesWriter< OutputImageType, WriterImageType >
WriterType;

WriterType::Pointer writer = WriterType::New();

writer->SetInput(resampler->GetOutput());

writer->SetImageIO(gdcmIO);
writer->SetMetaDataDictionaryArray( reader->GetMetaDataDictionaryArray() );

writer->SetFileNames(nameGen->GetFileNames());

  try
    {
    writer->Update();
    }
  catch( itk::ExceptionObject & excep )
    {
    std::cerr << "Exception catched !" << std::endl;
    std::cerr << excep << std::endl;
    }

  std::cout << "Resampling Done !" << std::endl;

  return EXIT_SUCCESS;
}







More information about the Insight-users mailing list