Can i change the indexing metafile for DICOM image format (DICOMDIR file)

4 views (last 30 days)
I am working with dynamic PET-scans, which consist of for instance 12 3D images each comprising 5 minutes of a total 1-hour scan. To generate an overview image I would like to generate a composite image in which al these 12 images are summed to have 1 cumulative image. I process these files with a dedicated medical image (free) software package, Amide. To import these images, the software uses the "DICOMDIR" file in which all slices are indexed. I am perfectly able to sum the images into one cumulative image en rewrite them into dicom slices, but now I should find a solution to create an according DICOMDIR file in order to read it in into my software Amide.
My idea was to look into the original DICOMDIR file to find where the indexing takes place, remove/change the fields which are no longer relevant and then rewrite this to a new DICOMDIR file. I used following code
meta_dicomdir=dicominfo('DICOMDIR');
for j = stop_i+4 : stop_k+3 % item 1-3 are metainfo not related to the consecutive slices
field_remove=sprintf('Item_%d',j);
meta_dicomdir.DirectoryRecordSequence=rmfield(meta_dicomdir.DirectoryRecordSequence,field_remove);
end
DICOMDIR_read=dicomread('DICOMDIR');
dicomwrite(DICOMDIR_read,'DICOMDIR_reformat',meta_dicomdir,'CreateMode','copy');
I read in the metafile, remove the indexing fields which are no longer relevant (which are in the DirectoryRecordSequence) and then I write a new dicomfile. The main issue I am having is that the even with the 'CreateMode','copy', the metainfo is reshaped and is structured as is for the slices. In short, It writes the new dicomfile as one of the slices, while it should keep the structure of the original DICOMDIR file. Is there any way I can have more freedom in customising the dicomwrite function or is there a way to directly remove the fields in the file, without having to rewrite a new file?
  1 Comment
Philippe Debanné
Philippe Debanné on 9 Aug 2017
This thread is over a year old but I will add my own experience. In my case, I needed to anonymize DICOM data. Removing the personal data from individual images is quite feasible with the dicomanon.m function, which you can tailor using the 'keep' and 'update' options. However, trying to modify the 'DICOMDIR' file doesn't work: dicomanon.m doesn't remove the personal data and dicomwrite.m does not give the expected result (even with the 'CreateMode','copy' option as you tried).
The solution for me was to generate a new 'DICOMDIR' from the anonymized dataset. I used the free tool 'DICOM_Dir' available here :
The restriction with that tool is that file and folder names must be only 8 alphanumeric characters long. There are other tools out there, e.g. the 'dicomdir' command-line tool available at:
(I haven't tried that one.) A function directly in Matlab to modify or regenerate the 'DICOMDIR' would be handy. Then again, the 'DICOMDIR' is not essential.

Sign in to comment.

Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!