Calculation Pixel In range
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi everyone,
I have min pixel value 0 and max pixel value 32767. How to me write the code if i want summation the pixel value from 1000 - 30000???
Anyone please help me..
채택된 답변
0 개 추천
Assuming that your image is of class double, then
sum(yourimage(yourimage >= 1000 & yourimage <= 30000)))
EDIT: As Image Analyst pointed out sum converts its input to double, so you can ignore the following:
If your image is of class int16, then convert it to double before doing the sum. (Otherwise, any sum above 32767 will be returned as 32767)
yourimage = double(yourimage); %if class(yourimage) is not double
댓글 수: 8
Image Analyst
2017년 11월 22일
Correction on the last part. sum() does the casting internally so you don't need to do it.
v = uint16([50000, 60000]) % Make a 16 bit array.
theSum = sum(v) % Shows 110000 (double), not 65535
whos theSum
v =
1×2 uint16 row vector
50000 60000
theSum =
110000
Name Size Bytes Class Attributes
theSum 1x1 8 double
mohd akmal masud
2017년 11월 26일
Thanks all for your feedback.
I have another question.
1) If i want to know the location(i mean location row and column) for min/max or any value pixel, what is the code to write.
2) If i want to know the total no pixel that have value (range 1000-30000), how to write the code?
3) If i have dicom image(256x256 dimension), how to know the length and width for one pixel. Noted that i know the thickness for one slice is 3.27 mm.
Hope you all can help me. Thank you so much in advanced.
Image Analyst
2017년 11월 26일
1)
maxValue = max(yourImage(:));
minValue = min(yourImage(:));
2)
mask = yourImage >= 1000 & yourImage <= 30000;
numPixelsInRange = sum(mask(:))
3)
That information should be in the header of the image. Use dicominfo(). If it's missing you'll have to have a known dimension in your image, like the field of view, or the size of some fixed object like a ruler. Then you can spatially calibrate like my attached demo shows.
mohd akmal masud
2017년 11월 26일
Thanks Image Analyst.
If i have 30 slice images, i want to sum all the slices that have pixel value range from 1000-30000, how to write the code??
info =
struct with fields:
...
PatientID: ...
PatientBirthDate: ...
PatientSex: ...
PatientAge: ...
PatientSize: ...
PatientWeight: ...
AdditionalPatientHistory: ...
...
I sincerely hope that the above is fake data. Otherwise, whichever country you live in you're most likely in breach of rules regarding patient confidentiality (which could lead to you getting prosecuted).
As for your question, please do make some effort towards trying to solve your problem yourselves rather than bombarding us with thousands of questions.
You've been told how to calculate the number of pixels within your range. Simply mulitply that number by the volume of a pixel to get the volumne you want. It's not hard.
As for finding the volume of a pixel, you can read as well as we can so read the name of each field of your structure and see if it could be the pixel volume. At first glance, it doesn't appear to be present.
mohd akmal masud
2017년 11월 27일
Thanks for your help.
Image Analyst
2017년 11월 27일
mohd, I gave you code. The code to sum pixels in the range will work with a 2-D image or a 3-D image (or any D image).
Not sure what "sum all the slices" means. My code sums (counts) the number of pixels in that range. If you want to sum the original gray scale values in the mask, rather than count pixels, then use
pixelValuesInMask = grayImage(mask); % A 1-D list of gray levels.
integratedGrayLevel = sum(pixelValuesInMask);
If your slices are not in a 3-D image but in separate files, then see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Sorry all, another question i have but i wrote at this space. please help me
Dear all,
this is my code to view CT image by slice
P = zeros(256, 256, 72);
for K = 1 : 72
petname = sprintf('I4%03d.dcm', K);
P(:,:,K) = dicomread(petname);
end
imshow3D(P)
then, this is my code for view SPECT image by slice,
Noted: all my 42 slice SPECT image stored in one file.
[spect map]=dicomread('128x128');
info = dicominfo('128x128');
gp=info.SliceThickness;
spect=(squeeze(spect));%smooth3
aa=size(spect);aa=aa(3);
imshow3D(spect);
Anybody can help me to fuse both SPECT and CT images for all slice?
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
