How dicomCollection sorts dicom filenames?

8 ビュー (過去 30 日間)
drummer
drummer 2020 年 8 月 22 日
コメント済み: drummer 2020 年 10 月 1 日
Hi,
I'm having issues when using dicomCollection to read multi-slice dicom volumes.
I'm basically following steps in this link. But here's my situation:
When loading regular dicom images (the ones I haven't processed), dicomCollection sorts the image slices correctly.
But when I try to load dicom images I created (sub-sampled MR images), it sorts like crazy, with no apparently intuitive ordering.
collection = dicomCollection(MyMRfolder, 'IncludeSubfolders', true);
for idx = 1 : numel(collection.Row)
dicomFilename = collection.Filenames{idx};
end
FYI: there are numbers in my dicom filenames suggesting its order, as image1.dcm, image2.dcm and so on. It happens to the 'untouched' dicom images as well.
How would it sort, if dicom headers such as InstanceNumber were correctly written using dicomwrite?
Thanks

採用された回答

drummer
drummer 2020 年 8 月 24 日
I just used sort to fix the problem
for idx = 1 : numel(collection.Row)
dicomFilename = sort(collection.Filenames{idx});
collection.Filenames{idx} = sort(collection.Filenames{idx});
end
That will correctly sort the files so dicomreadVolume can read it and build the volume correctly.
  2 件のコメント
Julianna Mather
Julianna Mather 2020 年 9 月 28 日
Just be aware, files aren't always stored with filenames that sort correctly. (It's actually pretty common for them not to be.) The only way to get it right is to inspect the position metadata inside the file.
Consider using dicomreadVolume, which takes care of this for you.
drummer
drummer 2020 年 10 月 1 日
Hi Jeff, indeed you're right. I've never seen such situation, but it certainly can occur.
Thanks for the tips using dicomReadVolume.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by