I have this simple code to extract individual frame images from Multiframe DICOM file
DcmDataset* DS;
DicomImage** ImgArr;
......
.........
for ( int fi=0; fi<NumFrames; fi++ ) {
ImgArr[fi] = new DicomImage((DcmObject*)DS,Tsynx,0,unsigned long(fi),unsigned long(1)));
}
So in Serial mode it works fine.
But if I try to execute the loop in parallel (f.e. parallel_for construct in VC++ ) this immediately fails
with the "read access violation" deep down the call stack.
Is this is supposed to be like this? Is there a workaround?
Problem is that I need to accelerate the operation because the file contains 4000 frames
Thank you so much
-Artem
Extracting frame Image from Multiframe DICOM is not thread safe?
Moderator: Moderator Team
-
- Posts: 32
- Joined: Mon, 2018-11-12, 20:01
-
- OFFIS DICOM Team
- Posts: 1445
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Extracting frame Image from Multiframe DICOM is not thread safe?
I don't think that this operation supports parallel calls, because they would all modify the status of the underlying DICOM dataset.
You might try to create clones of the DcmFileFormat/DcmDataset instance using the clone() method right after loading the file (at which point in time larger attributes have not been loaded yet, so that cloning the object does not hurt too much memory-wise). Then you could try creating the DicomImage instances in parallel. Perhaps that might work, but nobody will be able to guarantee that.
You might try to create clones of the DcmFileFormat/DcmDataset instance using the clone() method right after loading the file (at which point in time larger attributes have not been loaded yet, so that cloning the object does not hurt too much memory-wise). Then you could try creating the DicomImage instances in parallel. Perhaps that might work, but nobody will be able to guarantee that.
Who is online
Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 1 guest