how to open the image extension .dat
10 次查看(过去 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!