Browsing this Thread:   1 Anonymous Users


 Bottom   Previous Topic   Next Topic  Register To Post



Dicom File metadata modification error
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,

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@@ ... NTENT_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@@ ... NTENT_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..

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

Posted on: 2010/1/15 12:45
Transfer the post to other applications Transfer


Re: Dicom File metadata modification error
Core Team Member
Joined:
2005/9/15 8:27
From Bangalore, INDIA
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Posts: 117
Level : 9; EXP : 84
HP : 0 / 221
MP : 39 / 4966
Offline

Hi Manesh,

Pl use same solution as suggested for DicomFile. Create a new object for FileMetaInformation and store the FMI read from file and modify the created FMI instance and then you can store modified FMI while saving/writing the DicomFile.

Regards,

Piyush


Posted on: 2010/1/18 9:13
Transfer the post to other applications Transfer



 Top   Previous Topic   Next Topic

 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]