how to open the image extension .dat

23 views (last 30 days)
mohd akmal masud on 10 Feb 2022
Commented: DGM on 11 Feb 2022
Hi all,
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.
DGM on 11 Feb 2022
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 on 11 Feb 2022
Edited: DGM on 11 Feb 2022
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
1 1990656 2 995328 3 663552 4 497664 6 331776 8 248832 9 221184 12 165888 16 124416 18 110592 24 82944
% 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
ans = 6×3
768 2592 1 864 2304 1 972 2048 1 1024 1944 1 1152 1728 1 1296 1536 1
ans = 6×3
512 1944 2 576 1728 2 648 1536 2 768 1296 2 864 1152 2 972 1024 2
ans = 5×3
432 1536 3 512 1296 3 576 1152 3 648 1024 3 768 864 3
ans = 6×3
384 1296 4 432 1152 4 486 1024 4 512 972 4 576 864 4 648 768 4
ans = 6×3
288 1152 6 324 1024 6 384 864 6 432 768 6 512 648 6 576 576 6
ans = 6×3
256 972 8 288 864 8 324 768 8 384 648 8 432 576 8 486 512 8
ans = 4×3
256 864 9 288 768 9 384 576 9 432 512 9
ans = 5×3
216 768 12 256 648 12 288 576 12 324 512 12 384 432 12
ans = 6×3
192 648 16 216 576 16 243 512 16 256 486 16 288 432 16 324 384 16
ans = 4×3
192 576 18 216 512 18 256 432 18 288 384 18
ans = 6×3
144 576 24 162 512 24 192 432 24 216 384 24 256 324 24 288 288 24
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.
yanqi liu on 11 Feb 2022
yes，sir，may be check the data size
fid = fopen('voxel_man.dat','rb');
fclose(fid);
length(t)/512
fid = fopen('voxel_man.dat','rb');
fclose(fid);
length(t)/512
DGM on 11 Feb 2022
Yes, I just demonstrated the factorization of the vector length.

Benjamin Thompson on 10 Feb 2022
mohd akmal masud on 11 Feb 2022
I see.. then is it possible to convert into dicom format?
DGM on 11 Feb 2022
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.

Categories

Find more on Convert Image Type in Help Center and File Exchange

R2021b

Community Treasure Hunt

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

Start Hunting!