Browsing this Thread:   1 Anonymous Users


 Bottom   Previous Topic   Next Topic  Register To Post

(1) 2 »


System.IO.IOException: The file exists
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 596
Offline
Hi,

I am facing one critical problem.
My software is running fine. I am getting correct output.
But now it is not able to process the Dicom files. When I am running the application, it processes upto 539MB size of files (running fine till 539MB size files). After that it is giving me the following exception when processing the next dicom files.

--------------------------------------------------------------
Exception:

Error: File Reading: System.IO.IOException: The file exists.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.IO.Path.GetTempFileName()
at DvtkHighLevelInterface.Dicom.Other.Values.Set(Byte[] value)
at DvtkHighLevelInterface.Dicom.Other.AttributeSet.Set[T](TagSequence tagSequence, VR vR, T genericsParameter)
at DvtkHighLevelInterface.Dicom.Files.FileMetaInformation.Set(String tagSequence, VR vR, Byte[] value)
at DvtkHighLevelInterface.Dicom.Files.FileMetaInformation..ctor()
at _3disytems.DicomAnonymiserLibrary.DicomImageProcessor.ModifyDicomFile(String filePath) in E:\Projects\Working\Dicom Project\DicomEditorLibrary\DicomImageProcessor.cs:line 200
at _3disytems.DicomAnonymiserLibrary.DicomImageProcessor.DirSearch(String sDir) in E:\Projects\Working\Dicom Project\DicomEditorLibrary\DicomImageProcessor.cs:line 172 at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.IO.Path.GetTempFileName()
at DvtkHighLevelInterface.Dicom.Other.Values.Set(Byte[] value)
at DvtkHighLevelInterface.Dicom.Other.AttributeSet.Set[T](TagSequence tagSequence, VR vR, T genericsParameter)
at DvtkHighLevelInterface.Dicom.Files.FileMetaInformation.Set(String tagSequence, VR vR, Byte[] value)
at DvtkHighLevelInterface.Dicom.Files.FileMetaInformation..ctor()
at _3disytems.DicomAnonymiserLibrary.DicomImageProcessor.ModifyDicomFile(String filePath) in E:\Projects\Working\Dicom Project\DicomEditorLibrary\DicomImageProcessor.cs:line 200
at _3disytems.DicomAnonymiserLibrary.DicomImageProcessor.DirSearch(String sDir) in E:\Projects\Working\Dicom Project\DicomEditorLibrary\DicomImageProcessor.cs:line 172
--------------------------------------------------------------

This is not happening only this system, on another system also this problem occurring, where it is not able to processes single file.


Please can anyone tell me why this is happening?

Thanks,
Manesh

Posted on: 2010/2/4 15:58
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 596
Offline
I am giving you the source code of the .cs file where error is occurring.


public void DirSearch(string sDir)         {             Logger.Log(@"C:Dicom Files""Processing directories :" sDir);              try             {                 if (flag)                 {                     flag false;                     foreach (string file in Directory.GetFiles(sDir))                     {                         Logger.Log(@"C:Dicom Files""Processing file :" file);                         ModifyDicomFile(file);                     }                 }                  Logger.Log(@"C:Dicom Files""Getting directories from:" sDir);                 string[] str Directory.GetDirectories(sDir);                 foreach (string dir in str)                 {                     Logger.Log(@"C:Dicom Files""Getting files from:" dir);                     foreach (string file in Directory.GetFiles(dir))                     {                         Logger.Log(@"C:Dicom Files""Processing file :" file);                         ModifyDicomFile(file);                     }                      DirSearch(dir);                      Logger.Log(@"C:Dicom Files""Deleting directory :" dir);                     if (IsDeletionOn && Directory.GetFileSystemEntries(dir).Length == 0)                         Directory.Delete(dir);                 }                             }             catch (ArgumentNullException ex)             {                 Logger.Log(DicomImageProcessor.dirSettings.LogDirectory"Error: path is null : " ex.ToString() + "                    " ex.StackTrace);             }             catch (Exception ex)             {

//Exception is catching here of that error
                 
Logger.Log(DicomImageProcessor.dirSettings.LogDirectory"Error: File Reading: " ex.ToString() + "                    " ex.StackTrace);             }         }          

string targetPath;         
string processedPath;          

public 
void ModifyDicomFile(string filePath)       {             Logger.Log(@"C:Dicom Files""I am processing of :" filePath);              if (dataSet1 == null)                 dataSet1 = new DvtkHighLevelInterface.Dicom.Other.DataSet();              Logger.Log(@"C:Dicom Files""Initializing dataset");              

// Error is throwing here every time

if (fileMetaInfo1 == null)                 fileMetaInfo1 = new FileMetaInformation();              Logger.Log(@"C:Dicom Files""Initializing FMI");              if (dcmFile1 == null)                 dcmFile1 = new DicomFile();             theMDT.DCMFile filePath;              Logger.Log(@"C:Dicom Files""Initializing Dicom File 1");              try             {                 dcmFile1.Read(filePaththeMDT);                 Logger.Log(@"C:Dicom Files""Dicom file " filePath " is reading");                  processedPath DicomImageProcessor.dirSettings.ProcessedDirectory filePath.Substring(DicomImageProcessor.dirSettings.SourceDirectory.Length);                 dcmFile1.Write(processedPath);                 Logger.Log(@"C:Dicom Files""Dicom file " processedPath " is writing in processed");                  fileMetaInfo1 dcmFile1.FileMetaInformation;                 dataSet1 dcmFile1.DataSet;                  if (DicomImageProcessor.attrInfo.PatientName == null || DicomImageProcessor.attrInfo.PatientName == "" || DicomImageProcessor.attrInfo.PatientID == null || DicomImageProcessor.attrInfo.PatientID == "" || DicomImageProcessor.attrInfo.PatientDOB == null || DicomImageProcessor.attrInfo.PatientDOB == "")                     Logger.Log(DicomImageProcessor.dirSettings.LogDirectory"some information of Patient is missing in App.config");                                  if (dcmFile2 == null)                     dcmFile2 = new DicomFile();                 Logger.Log(@"C:Dicom Files""Initializing Dicom File 2");                  dcmFile2.FileMetaInformation fileMetaInfo1;                 dcmFile2.DataSet dataSet1;                  dcmFile2.DataSet.Set("0x00100010"VR.PNDicomImageProcessor.attrInfo.PatientName);                 dcmFile2.DataSet.Set("0x00100020"VR.LODicomImageProcessor.attrInfo.PatientID);                 dcmFile2.DataSet.Set("0x00100030"VR.DADicomImageProcessor.attrInfo.PatientDOB);                                  Logger.Log(@"C:Dicom Files""Dicom file " filePath " is modifying");                  if (!filePath.Contains(".dcm"))                 {                     targetPath DicomImageProcessor.dirSettings.TargetDirectory filePath.Substring(DicomImageProcessor.dirSettings.SourceDirectory.Length) + ".dcm";                 }                 else                 {                     targetPath DicomImageProcessor.dirSettings.TargetDirectory filePath.Substring(DicomImageProcessor.dirSettings.SourceDirectory.Length);                 }                   Logger.Log(@"C:Dicom Files""Dicom file " targetPath " is writing in processed");                 dcmFile2.Write(targetPath);                 try                 {                     Logger.Log(@"C:Dicom Files""Dicom file " filePath " is deleting from source");                      if (IsDeletionOn)                         File.Delete(filePath);                 }                 catch (Exception e)                 {                     Logger.Log(dirSettings.LogDirectoryString.Format("Error in file dicom file deletion {0}.n Exception: {1}"filePathe.ToString()));                 }             }             catch (Exception e)             {                 Logger.Log(dirSettings.LogDirectoryString.Format("Error in modifying dicom file {0}.n Exception: {1}"filePathe.ToString()));                             }             catch             {                 Logger.Log(dirSettings.LogDirectoryString.Format("Error in modifying dicom file {0}."filePath));                             }              dataSet1 null;             dcmFile1 null;             dcmFile2 null;             fileMetaInfo1 null;              Logger.Log(@"C:Dicom Files""I have completed processing of :");          }           public class MainDicomThread DicomThread     {         string dcmFilePath String.Empty;         DicomFile dcmFile1 null;          public string DCMFile         {             set dcmFilePath value; }         }          protected override void Execute()         {             try             {                 if (dcmFile1 == null)                     dcmFile1 = new DicomFile();                 dcmFile1.Read(dcmFilePaththis);             }             catch (Exception e)             {                 throw e;             }             catch             {                 throw;             }         }     }


Thanks,
Manesh

Posted on: 2010/2/4 16:30
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 596
Offline
Sorry, the source is not looking good.
I am attaching one file
Please check that for code snippet.

Thanks,
manesh

Posted on: 2010/2/4 16:34
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 596
Offline
check attachment for code snippet of problem

Posted on: 2010/2/4 16:37
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 596
Offline
not able to attach the file.

Posted on: 2010/2/4 16:38
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 596
Offline
Hi friends,

Nobody reply me for my problem. OK no problem.

Now I got why & where actually the problem occurring.

When I am processing the dicom files (huge no. of files eg. 9GB)
It is creating .tmp files in C:\Document and Setting\\Local Settings\Temp.

In this temp folder only 65735 no. of temp (.tmp) files can be created.

That is why the problem is coming. So If I delete these temp files then I am able to process my all dicom files.

----------------------------------------------------------------
Quote:
New Problem:


But Now the problem is that why these temp files are generated when processing the dicom files.

because, I am doing following thing to prevent from creating *.pix & *.idx in System Temp directory.


DicomThread
.Options.DataDirectory "C:DTemp"DicomThread.Options.ResultsDirectory "C:DTemp";


And now *.pix & *.idx files are created in "C:\DTemp" directory, so I can delete all *.pix & *.idx files after processing.

So If *.pix & *.idx files are created in C:\DTemp directory,
Why .tmp files are created in System Temp directory

Please help me out of these problem.


Thanks,
Manesh

Posted on: 2010/2/5 12:04
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Webmaster
Joined:
2006/10/12 14:45
From Best, Netherlands
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Posts: 259
Level : 15; EXP : 5
HP : 0 / 351
MP : 86 / 6785
Offline
Sorry for the late reaction. I will have someone from the developers look into this.

Posted on: 2010/3/31 10:03
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Webmaster
Joined:
2005/6/21 15:06
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Steering Committee Members
Services Request Listeners
Webinar organisation
Posts: 249
Level : 14; EXP : 75
HP : 0 / 343
MP : 83 / 7957
Offline
Hi Manesh,

the reason for this to occur is the following.
The High Level Interface layer, you are using, uses a lot of functionality from the lower DVTkData layer, both part of the DVTk library.

In the DVTkData layer, when setting the content of an attribute with VR OB, OW or OF, this is always done by supplying a file containing the bytes to use for the value of such an attribute.

What no happens is the following:
- You construct an instance of the class FileMetaInformation.
- This implicitly sets the attribute "File Meta Information Version" which has VR OB.
- This implicitly creates a temp file that will not be removed in this scenario.

Can you submit a ticket for this (using a lot of copy-and-paste from this forum)? You will then be able to follow the progress.

Regards,
Marco

Posted on: 2010/4/1 10:42
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Quite a regular
Joined:
2010/3/23 15:01
Group:
Registered Users
Posts: 24
Level : 3; EXP : 62
HP : 0 / 65
MP : 8 / 607
Offline
Additional information;
If there is not enough space on the disk drive, library also goes into FileNotFound exception.

Posted on: 2010/12/10 7:52
Transfer the post to other applications Transfer


Re: System.IO.IOException: The file exists
Not too shy to talk
Joined:
2011/2/18 3:19
Group:
Registered Users
Posts: 5
Level : 1; EXP : 34
HP : 0 / 8
MP : 1 / 56
Offline
"check attachment for code snippet of problem"

This is right.

Posted on: 2011/2/22 2:44
_________________
silk duvetsSilk Beddingwww.revesilkdirect.com/silk-duvets-c-1.html
www.ugg-style.com
www.monosilk.com
Transfer the post to other applications Transfer



 Top   Previous Topic   Next Topic
(1) 2 »

 Register To Post


You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]