How to change the pixel value int16 to new value?

조회 수: 1 (최근 30일)
mohd akmal masud
mohd akmal masud 2022년 4월 28일
답변: Image Analyst 2023년 9월 7일
Dear All,
I have image dicom. as attached. dimension is 128x128, have 45 frame. the type is int16.
I want to convert all the pixel value with new value IMG_cps as code below (the last one).
Anyone can help me?
clc
clear all
close all
Image_name = 'SPECTCTLD_EM_IRNCRR001_DS.dcm'; % add your file name
%% read dicom image
IMG = dicomread(Image_name);
IMG = double(IMG); % chage data type double
%% read dicom information
INFO = dicominfo(Image_name);
% time per projection
Time_per_projection = double(INFO.RotationInformationSequence.Item_1.ActualFrameDuration); % in msec
Time_per_projection = Time_per_projection/1000; % convert to sec
% number of projection
Num_projection = double(INFO.RotationInformationSequence.Item_1.NumberOfFramesInRotation);
% calculate acquisition time
Acquistion_duration = Time_per_projection * Num_projection; % sec
%% calculate cps in each pixel
IMG_cps = IMG/Acquistion_duration;

답변 (1개)

Image Analyst
Image Analyst 2023년 9월 7일
Not sure I understand this: "I want to convert all the pixel value with new value IMG_cps" but why can't you just say
IMG(:,:) = IMG_cps;
where IMG_cps is your desired new gray level.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by