how to open the image extension .dat
조회 수: 25 (최근 30일)
이전 댓글 표시
Hi all,
I was Download the Zubal phantom from this site: http://noodle.med.yale.edu/phantom/getzubdata.htm
I attached the file.
But anyone can help me how to open it as CT view images? Because I know the files is CT image phantom.
댓글 수: 1
DGM
2022년 2월 11일
I can't log into that site. Do you know what the image geometry is supposed to be?
It's readable, but without the header file or any other info, it's just guesswork to rectify it.
채택된 답변
DGM
2022년 2월 11일
편집: DGM
2022년 2월 11일
Knowing the image geometry is 90% of the battle. Imrectify() can do a good job of figuring it out, but I never wrote it to handle multipage images. Realistically, expanding the problem of guesswork into 3D really obliterates the constraints that make the task able to be simplified as such.
I don't have an answer, but here is some insight. I'm just going to rename the file so it can be uploaded here.
fid = fopen('voxel_man.dat.txt','r');
A = fread(fid,Inf,'*uint16'); % i'm assuming it's uint16
fclose(fid);
% find valid page counts
np = 1:25; % let's assume this has a pagecount in this range
ppix = numel(A)./np;
isgood = mod(ppix,1)==0;
ppix = ppix(isgood);
np = np(isgood);
fprintf('%d\t%d\n',[np; ppix]) % these are the valid pagecounts and pagelengths
% dump high-AR candidate geometries for each page count
% this assumes that any practical page size has a normalized aspect ratio >= 1/4
for pp = 1:numel(np)
P = pairfactor(ppix(pp),false);
Phar = P(P(:,1)./P(:,2) >= 0.25,:);
[Phar repmat(np(pp),size(Phar,1),1)]
end
I would assume that the pages would be relatively small and relatively square; maybe 512x512 or something simple. After trying a dozen different geometries, I'm not sure.
This should at least serve as a demonstration for how to find candidate geometries.
EDIT:
Here. Try this.
fid = fopen('voxel_man.dat.txt','r');
A = fread(fid,Inf,'*uint16'); % i'm assuming it's uint16
fclose(fid);
B = reshape(A,64,128,[]); % there's your image
imshow(B(:,:,100),[])
I didn't expect the page size to be so small. Assuming a low page count was leaving me soundly in the realm of pixel salads.
댓글 수: 2
yanqi liu
2022년 2월 11일
yes,sir,may be check the data size
fid = fopen('voxel_man.dat','rb');
t = fread(fid, 'float');
fclose(fid);
length(t)/512
fid = fopen('voxel_man.dat','rb');
t = fread(fid, 'uint8');
fclose(fid);
length(t)/512
추가 답변 (1개)
Benjamin Thompson
2022년 2월 10일
Can your tool save to NII or NifTI format, then load it using niftiread in MATLAB?
댓글 수: 5
DGM
2022년 2월 11일
You can create the header info and then use dicomwrite().
These tools might be sufficient, depending on your needs.
Though if nothing else, you can simply look at how it's doing the file configuration internally.
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!