Troubles using dicomwrite() for the PET modality?

조회 수: 3 (최근 30일)
Bryce Johnson
Bryce Johnson 2019년 8월 6일
답변: Laure Saint-Aubert 2019년 12월 3일
I have many PET slices in the dicom format. I am trying to manipulate the metadata of each slice (specifically the ImagePositionPatient fieldname) in order to automatically center the image at the origin in an image viewer(Amide). To do this I must use the dicomread, dicominfo, and dicomwrite functions.
d=dicominfo(fid); % dicom object
V=dicomread(fid); % dicom volume
xdcm=-((double(d.Rows)*double(d.PixelSpacing(1)))/2); % reset the xy Image Position
% so that it will view at the origin for my image viewer
ydcm=-((double(d.Columns)*double(d.PixelSpacing(2)))/2);
d.ImagePositionPatient(:)=[xdcm,ydcm];
dicomwrite(V,fid,d); % write this new dicom object in the same file.
I have done this successfully for the 'CT' modality, but keep running into errors for the 'PT' modality. I believe this is because dicomwrite doesn't support usage of PET data. The error I'm getting looks something like this:
% Error using dicom_prep_metadata (line 92)
% Unsupported SOP class (1.2.840.10008.5.1.4.1.1.128) in full verification mode.
% Consider using 'CreateMode' with a value of 'Copy'.
I'm thinking of just changing the SOPclass to a 'CT' number in order to just "cheat the system", but surly their has to be away to write a dicom volume for a PET dicom object?
Any help is greatly appreciated.
Thanks,
Bryce

채택된 답변

Jyotsna Talluri
Jyotsna Talluri 2019년 8월 9일
편집: Jyotsna Talluri 2019년 8월 11일
Hi,
Try using
dicomwrite(V,fid,d,'CreateMode','copy');
dicomwrite does not verify the metadata written to the file when CreateMode parameter is set to ‘copy'
Hope it helps
  댓글 수: 1
Bryce Johnson
Bryce Johnson 2019년 8월 12일
This answer works and is exactly the kind of trick I was looking for. Thank you!!!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Laure Saint-Aubert
Laure Saint-Aubert 2019년 12월 3일
Hi,
I am also trying to center my PET images at the origin, so I thought of benefiting from your post and code.
However, when I am trying to run it, I can't seem to make it work because of the number of dimensions of ImagePositionPatient ([3x1 double]), so d.ImagePositionPatient(:)[xdcm,ydcm] gives me the following message: "In an assignment A(:)=B, the number of elements in A and B must be the same".
I believe I should also reset the z dimension of Image Position, but I can't figure out how to.
Any help is more than welcome :)
Cheers
Laure

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by