フィルターのクリア

How to use dicomwrite after modification

4 ビュー (過去 30 日間)
Ahmad Abbas
Ahmad Abbas 2020 年 8 月 10 日
コメント済み: Walter Roberson 2020 年 8 月 10 日
how i can use dicomwrite and copy the metadata for the code below
clear
myFolder = 'C:\Users\Admin\Desktop\MATLAB\Crop cochlea';
filePattern = fullfile(myFolder, '*dcm');
theFiles = dir(filePattern);
crop=zeros(209,218,394);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n',fullFileName);
crop(:,:,k)=x;
end
tmp11 = min(max (0.7966*crop -568.5, -1000),4096);
hu = uint16(tmp11);
imagesc(hu(:,:,200))

採用された回答

Walter Roberson
Walter Roberson 2020 年 8 月 10 日
編集済み: Walter Roberson 2020 年 8 月 10 日
You are constructing file names for all the dcm files in the directory. You iterate over each one, displaying a file name appropriate for each. You the assign the undefined variable x to a variable indexed by the file number.
You are not presently reading any file. You are not presently collecting any dicom metadata. If you were collecting it, then which one would you want to collect, since you seem to be wanting to write a single output file? The single output file looks likely to want to be the adjusted value hu, which is a stack of images, but metadata for one file would not be appropriate for a stack of images in dicom. Perhaps you want to write just file #200 ? Why bother to read the other files then?
tmp11 = min(max (0.7966*crop -568.5, -1000),4096);
0.7966*crop -568.5 values that come out smaller than -1000 would be replaced with -1000 . Resulting values that are more than 4096 would be replaced with 4096. The resulting range of values would be -1000 to 4096.
hu = uint16(tmp11);
Minimum value of uint16 is 0, so all the values in the range -1000 to 0 would be replaced by 0 when doing the uint16 conversion. If that was the intention, then why not use max with 0 instead of -1000 ? Or code is not making sense.
crop=zeros(209,218,394);
You do that no matter how many files there are in the directory.
crop(:,:,k)=x;
are you sure that the undefined variable or function x will return a result that is exactly 209 x 218 ?
  2 件のコメント
Ahmad Abbas
Ahmad Abbas 2020 年 8 月 10 日
my idea is to convert the pixel value to HU
i need the convertion for all the dicom but used 200 just to show the result
Walter Roberson
Walter Roberson 2020 年 8 月 10 日

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

その他の回答 (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