How to read .hdr files in Matlab?
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jab
le 20 Sep 2015
Commenté : Walter Roberson
le 20 Sep 2015
All the volumes(image 3D) location are stored in a variable called Fulfilename as
Fulfilename 178*1 cell
'D:\Oasis\Database\disc1\OAS1_0001_MR1\PROCESSED\MPRAGE\T88_111\OAS1_0001_MR1_mpr_n4_anon_111_t88_masked_gfc.hdr '
'D:\Oasis\Database\disc1\OAS1_0003_MR1\PROCESSED\MPRAGE\T88_111\OAS1_0003_MR1_mpr_n4_anon_111_t88_masked_gfc.hdr '
'D:\Oasis\Database\disc1\OAS1_0010_MR1\PROCESSED\MPRAGE\T88_111\OAS1_0010_MR1_mpr_n4_anon_111_t88_masked_gfc.hdr '
'D:\Oasis\Database\disc1\OAS1_0013_MR1\PROCESSED\MPRAGE\T88_111\OAS1_0013_MR1_mpr_n4_anon_111_t88_masked_gfc.hdr ' etc
I need to read all the images in Matlab. I tired with some code. It doesnt help me. Any help is appreciated. My code is the following:-
load Fulfilename;
for p=1:178
V= hdr_read_volume('Fulfilename{p}');
end
0 commentaires
Réponse acceptée
Walter Roberson
le 20 Sep 2015
load Fulfilename;
for p = 1 : length(Fulfilename)
V{p} = hdr_read_volume(Fulfilename{p});
end
2 commentaires
Walter Roberson
le 20 Sep 2015
Your filename list has trailing blanks on each of the strings. Code that accounts for that is
load Fulfilename;
Fulfilename = strtrim(Fulfilename);
for p = 1 : length(Fulfilename)
V{p} = hdr_read_volume(Fulfilename{p});
end
Plus de réponses (1)
Image Analyst
le 20 Sep 2015
Fulfilename{p} is already a string. So then you're surrounding a string with quotes, but this actually does not evaluate Fulfilename{p} but just puts Fulfilename{p} into the string as a literal. So 'Fulfilename{p}' will be laterally that -- it will not be 'D:\Oasis\Database\disc1\OAS1_0001_MR1\PROCESSED\MPRAGE\T88_111\OAS1_0001_MR1_mpr_n4_anon_111_t88_masked_gfc.hdr'
There you will find out how to use braces and parentheses and quotes. You'd learn that you're supposed to do
V = hdr_read_volume(Fulfilename{p});
because Fulfilename{p} is already a string and you should not put it into quotes.
0 commentaires
Voir également
Catégories
En savoir plus sur Import, Export, and Conversion dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!