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

Luis Ibanez luis.ibanez at kitware.com
Mon Jan 15 17:13:33 EST 2007


Hi Verena,

The code that generates this error message is quite straight forward:


Insight/Code/IO/itkGDCMImageIO.cxx : lines 160-170:

>   os.open( filename, std::ios::out | std::ios::binary );
> 
>   if( os.fail() )
>     {
>     itkExceptionMacro(<< "Could not open file: "
>                       << filename << " for writing."
>                       << std::endl
>                       << "Reasion: "
>                       << itksys::SystemTools::GetLastSystemError());
>     return false;
>     }
> 

Can you please post to the list the *exact* filename
for which you are getting this error message ?


   Thanks



      Luis



-----------------------------
verenas at uni-koblenz.de wrote:
> 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;
> }
> 
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list