Is it possible to write a double data matrix into TIFF images ( Movie)?
Afficher commentaires plus anciens
I have a 100X100X19 matrix in the attached Aniso file. Now I want to convert those double data into images ( Movie). Is it at all possible?
FYI: I have used MATLAB "Tiff" function but it supports only the int16 data.
13 commentaires
Jan
le 13 Jan 2018
What exactly is 'MATLAB "Tiff" function'? Please post the code and a copy of the complete error message.
Jaladhar Mahato
le 13 Jan 2018
Modifié(e) : Walter Roberson
le 20 Nov 2021
sb icse
le 23 Nov 2018
Have you found out the solution to your question?If yes then can you share the code and thank you in advance.
Jaladhar Mahato
le 23 Nov 2018
sb icse
le 23 Nov 2018
If it is an image then how to modify your code?
Jaladhar Mahato
le 23 Nov 2018
sb icse
le 23 Nov 2018
please give me the code for both jpg and tif.
sb icse
le 23 Nov 2018
j=1143 1142 1134 1132 1119 1101 1104 1099 1085
this are the pixel values present in the matrix j.Now I want it to be converted to an image without the loss of precision.But when I am doing so all the values are changing to 255.
Walter Roberson
le 23 Nov 2018
Modifié(e) : Walter Roberson
le 23 Nov 2018
imwrite(uint16(j),FilenameGoesHere )
Jaladhar Mahato
le 23 Nov 2018
Modifié(e) : Jaladhar Mahato
le 25 Nov 2018
Jan
le 24 Nov 2018
"Members replied just to get higher in MATLAB rank."
Sigh. The selfish members just do not care about the problems of the asking persons.
Walter Roberson
le 24 Nov 2018
The imwrite2tif code that you attached as the solution is the code I linked to back on January 14 2018, the day after you posted your question.
So far I still find no evidence that any program supports movies stored in TIFF format. ImageJ supports reading TIFF into a "stack" and supports animating a stack, but if you wanted to save that as a video you would need animated GIF or AVI in ImageJ itself, with some other possibilities such as QuickTime being available through plugins -- but not one of the plugins I found supports movies stored in TIFF format.
Jaladhar Mahato
le 25 Nov 2018
Modifié(e) : Jaladhar Mahato
le 25 Nov 2018
Réponse acceptée
Plus de réponses (2)
Jan
le 13 Jan 2018
This will work with imwrite.
Data = load('Aniso.mat');
A = Data.A;
imwrite(A(:, :, 1), 'test.tiff');
for k = 2:size(A, 3)
imwrite(A(:, :, k), 'test.tiff', 'WriteMode', 'append');
end
4 commentaires
Jaladhar Mahato
le 13 Jan 2018
Jan
le 13 Jan 2018
And as far as I understand your comment, you have used something like:
t = Tiff('myfile.tif', 'w');
t.write(A(:, :, k))
and this works for 16 bit data, but you want it for 32 bit data also? Sorry, I still so not get the problem.
Jaladhar Mahato
le 14 Jan 2018
Jan
le 14 Jan 2018
You can convert the decimal values to uint16 by:
data = rand(640, 480);
dataU16 = im2uint16(data);
This can be written for uint32 also:
dataU32 = data * intmax('uint32');
Of course you loos some precision, but TIFF files are not designed to store double data. As you see in Walter's answer, at least single would work.
Alexandra Holland
le 19 Nov 2021
I hope this can help some of you. I am not sure if this is answering your question though, but you can save your double as a .mat file, then load it, then extract it from the resulting structure as follows:
cd(folder_name)
save('file_name.mat','var_name');
X = load('file_name.mat');
Since you end up with a structure, you need to extract the data as follows:
Y = X.var_name; % voila. You have your double back.
You can check you end up with the exact same with the command
Z=mean(Y-var_name,'all'); % and you can verify that Z=0.
1 commentaire
Walter Roberson
le 20 Nov 2021
I do not see how this would have helped? The original poster already had their data as a .mat file.
Catégories
En savoir plus sur Data Import and Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!