System.AccessViolationException....

Joined
Jan 15, 2010
Messages
1
Reaction score
0
Hi friends,

I am facing one serious problem in my application.
I am trying to open dicom image file (.dcm) has size around 400 MB.
But I am getting and unhandy exceptions,

Some time,

{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at ?readMedia@BASE_SESSION_CLASS@@$$FQAEPAVFILE_DATASET_CLASS@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4MEDIA_FILE_CONTENT_TYPE_ENUM@@000_N2@Z(BASE_SESSION_CLASS* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , Int32 , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , Boolean , Boolean )
at Wrappers.MBaseSession.ReadMedia(String pFileName)
at Dvtk.Sessions.Session.ReadFile(String mediaFileName)
at DvtkHighLevelInterface.Dicom.Files.DicomFile.Read(String fullFileName, ScriptSession dvtkScriptSession)
at DvtkHighLevelInterface.Dicom.Files.DicomFile.Read(String fullFileName, String[] definitionFilesFullName)
at _3disytems.DicomAnonymiserLibrary.DicomImageProcessor.ModifyDicomFile(String filePath) in E:\Projects\Working\Dicom Project\DicomEditorLibrary\DicomImageProcessor.cs:line 63}


and Some times

{System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at ?readMedia@BASE_SESSION_CLASS@@$$FQAEPAVFILE_DATASET_CLASS@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4MEDIA_FILE_CONTENT_TYPE_ENUM@@000_N2@Z(BASE_SESSION_CLASS* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , Int32 , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* , Boolean , Boolean )
at Wrappers.MBaseSession.ReadMedia(String pFileName)
at Dvtk.Sessions.Session.ReadFile(String mediaFileName)
at DvtkHighLevelInterface.Dicom.Files.DicomFile.Read(String fullFileName, ScriptSession dvtkScriptSession)
at DvtkHighLevelInterface.Dicom.Files.DicomFile.Read(String fullFileName, String[] definitionFilesFullName)
at _3disytems.DicomAnonymiserLibrary.DicomImageProcessor.ModifyDicomFile(String filePath) in E:\Projects\Working\Dicom Project\DicomEditorLibrary\DicomImageProcessor.cs:line 63}


These exception not getting for every files, only for large files when I am trying to read them.

I am using DVTK Library for Dicom images provided by DVTK. It's open source
http://www.dvtk.org

Following code ex I am using..

Code:
public static void ModifyDicomFile(string filePath)
		{
			DicomFile theDicomFile;
			try
			{
				theDicomFile = new DicomFile();
				theDicomFile.Read(filePath);

				if (attrInfo.PatientName == null || attrInfo.PatientName == "" || attrInfo.PatientID == null || attrInfo.PatientID == "" || attrInfo.PatientDOB == null || attrInfo.PatientDOB == "")
					Logger.Log(dirSettings.LogDirectory, "some information of Patient is missing in App.config");

				theDicomFile.DataSet.Set("0x00100010", VR.PN, attrInfo.PatientName);
				theDicomFile.DataSet.Set("0x00100020", VR.LO, attrInfo.PatientID);
				theDicomFile.DataSet.Set("0x00100030", VR.DA, attrInfo.PatientDOB);

				string relPath;

				if (!filePath.Contains(".dcm"))
				{
					relPath = dirSettings.TargetDirectory + filePath.Substring(dirSettings.SourceDirectory.Length) + ".dcm";
				}
				else
				{
					relPath = dirSettings.TargetDirectory + filePath.Substring(dirSettings.SourceDirectory.Length);
				}

				theDicomFile.Write(relPath);

				// File.Delete(filePath);
			}
			catch (Exception e)
			{
				Logger.Log(dirSettings.LogDirectory, "Error: Dicom File Modification : " + e.Message);
			}
		}


I am want to tell you that this is working for small files(2-5mb) but it giving problem me when I am trying to read 400MB files

Please solve this problem.
This is .Dot net only

Thanks,
Manesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top