System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Quite a regular
![]()
Joined:
2010/1/6 11:51 Group:
Registered Users Posts:
22
Level : 3; EXP : 41
HP : 0 / 60 MP : 7 / 596 ![]() |
To view this post, you must login and reply first.
Posted on: 2010/1/15 8:36
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
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 / 4964 ![]() |
Hi Manesh, I think there is some problem in your DICOM file. From logging i can say that some attribute is not encoded properly. Can u attach the DICOM file which is causing exception? If it's a big file then you can upload the file on File Factory site and send us the link. Contact us if you face any problem in send/upload/attach the file. Regards, Piyush
Posted on: 2010/1/15 9:45
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Quite a regular
![]()
Joined:
2010/1/6 11:51 Group:
Registered Users Posts:
22
Level : 3; EXP : 41
HP : 0 / 60 MP : 7 / 596 ![]() |
Hi Piyush,
Thanks for the reply. I am uploding the file on File Factory Site. But I thing Dicom file doesnot have any problem. Beacause I have opened it with DCM Editor, and it's opening fine and showing all attributes. It's not the single file giving such error, But all the files which has large size giving error. If I am not wrong, but is it the problem of memory. Means should I need to increase the virtual memory or increase the Heap size programmatically. And if yes, then how to do this? Thanks & Regards, Manesh
Posted on: 2010/1/15 13:14
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Quite a regular
![]()
Joined:
2010/1/6 11:51 Group:
Registered Users Posts:
22
Level : 3; EXP : 41
HP : 0 / 60 MP : 7 / 596 ![]() |
1) http://www.filefactory.com/file/a198b ... 525.1218592081.693242.dcm
2) http://www.filefactory.com/file/a198b ... 705.1222746142.217505.zip These are the two file urls I have uploaded of http://www.filefactory.com One file is working for me using my code but file who's size large is giving me the Exception
Posted on: 2010/1/15 13:21
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Quite a regular
![]()
Joined:
2010/1/6 11:51 Group:
Registered Users Posts:
22
Level : 3; EXP : 41
HP : 0 / 60 MP : 7 / 596 ![]() |
Hi friends,
I have sent you the dicom files as you ask for. I am still stick with the same problem. Is this the problem of Dicom Api's. When I am trying to do the same thing using Java and other 3rd Path Dll's (Like DVTK). There were also same problem occurring. So I was increased the Heap size there using (java -Xms2 -Xmx8 .class) command. And the problem was solved. So is it the problem of Heap size? But as I know, in .net there is no need to increase the Heap Size pro grammatically, because heap is automatically grows as per need till 64MB size (by default) Manesh.
Posted on: 2010/1/18 8:49
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
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 / 4964 ![]() |
Hi Manesh, I analyzed the problem and found you can't read and write using same instance of DicomFile object. This is causing the exception. Pl use the following code for writing the new DICOM file: DataSet dataset = new HLI.DataSet();FileMetaInformation fileMetaInfo = new FileMetaInformation(); // Read the Media file DicomFile dcmFile1 = new DicomFile();
dcmFile1.Read(dicomFile, thread); fileMetaInfo = dcmFile1.FileMetaInformation; dataset = dcmFile1.DataSet; DicomFile dcmFile2 = new DicomFile();// Add previously read FMI to Media file dcmFile2.FileMetaInformation = fileMetaInfo ; // Add previously read dataset to Media file dcmFile2.DataSet = dataset; dcmFile2.Write(filePath); I think this will help. Pl get back to us for any query. Regards, Piyush
Posted on: 2010/1/18 9:08
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Quite a regular
![]()
Joined:
2010/1/6 11:51 Group:
Registered Users Posts:
22
Level : 3; EXP : 41
HP : 0 / 60 MP : 7 / 596 ![]() |
Hi Piyush,
Thanks for the reply again. I am sending the whole source code of my application. Currently I am not passing any thread instance in DicomFile.Read(filePath); which thread instance I have to pass. The given source code. You will understand what I am doing and what is wrong there. Please kindly see the code and reply for this also. Thanks & Regards, Manesh Borase.
Posted on: 2010/1/18 10:25
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Quite a regular
![]()
Joined:
2010/1/6 11:51 Group:
Registered Users Posts:
22
Level : 3; EXP : 41
HP : 0 / 60 MP : 7 / 596 ![]() |
Hi,
One more thing is that, When I am trying to modify huge no. of files (small size files). It works fine, but It takes lot of memory to process all files (eg. it reaches upto 1.5GB+ memory). Is this problem because of file may not be closed when reading? OR need to close the Dataset or FileMetaInformation? It may be hang my system if it try to modify more no of files. Thanks, Manesh
Posted on: 2010/1/18 11:40
|
|
Transfer
|
||
Re: System.AccessViolationException: Attempted to read or write protected memory.... |
||
|---|---|---|
|
Core Team Member
![]()
Joined:
2009/8/24 14:14 Group:
Webmasters Registered Users Core Developers Posts:
34
Level : 4; EXP : 59
HP : 0 / 89 MP : 11 / 982 ![]() |
Hi Manesh, The exception was being thrown because the corresponding definition file was not loaded.You should perform the read and write operations on Dicom Thread. I have modified your source file accordingly.If you are using a different DICOM image, load the corresponding SOP class before you perform read/write operations.
Posted on: 2010/1/19 7:58
|
|
Transfer
|
||





Transfer

DicomProject.zip