Conversion from DICOM to YUV file - matlab

I have a series of DICOM files that I loaded on matlab. I would need to create a YUV file from the DICOM slices.Does anybody know how to do so?
Regards,

Note sure if this answers your question, but there is some code for this on the MATLAB file exchange:
http://www.mathworks.com/matlabcentral/fileexchange/11264-matlab-movie-to-yuv-file
I know this is for movies, but I think you will be able to use this code (maybe adapted) to run it for each slice separately, if that's what you want.

Related

How to save features into .mat file and .txt file using python in keras?

I would like to save my predicted features into .mat format and .txt format in keras for further process in Matlab. Please help me. Thanks.
For .mat, check out SciPy's File IO.
For .txt, there are many options, such as NumPy's savetxt.
Check out the CSV format as well, which is a common way to save data for cross-platform use.

Read and represent mp3 files using memmapfile in matlab

I have to analyze bio acoustic audiofiles using matlab. Eventually I want to be able to find anomalies in the audio. That's the reason I need to find a way to represent the audio in a way I can extract and compare features. I'm dealing with mp3 files up to 150 mb. These files are too large for matlab to read in to it's memory. Therefore I want to use the memmapfile() function. I used the following code and a small mp3 file to find out how it actually works.
[testR, ~] = audioread('test.mp3');
testM = memmapfile('test.mp3');
disp(testM.Data);
disp(testR);
The actual values of the testM.Data and testR are different. Audioread() returns a 7483391 x 2 matrix and memmapfile() a 4113874 x 1 matrix.
I'm not really sure how memmapfile() works, I expected this to be equal to each other. Is there a way to read mp3 files in the same format audioread() does using memmapfile()? And what does memmapfile actually return in case of an audio file? Maybe it's also usable in the vector format in the case of anomaly detection?
Thanks in advance!
NOTE: The original files were in wav IMA ADPCM format with sizes from 1.5 up to 2.5 gb. Since Matlab can't deal with that format and the size of the files I converted them to 8bit mp3 files.
I think that the problem is mammapfile by default read data in uint8 format, while audioread function read data in another way.
How you can see here you can specify the format of data when you read it with memmapfile, so try to "play" with different values. From the documentation I read that you can read data in double format, so try to modify the memmapfile data format and audioread data format.
Last thing, memmapfile always organize the data in matrix like "somenumbers x 1", so if you want the original one you need to use something like reshape.
Anyway if you work with big data I suggest you to try with something different instead memmapfile, because it is very very slow

Matlab Audio Format- How to process?

I have downloaded a EEG recording of a person in Matlab-Audio Format. I have no idea of how to use it in Matlab for further processing. Is it possible to generate signals in Matlab? If so, is there any code to generate EEG signal?
Any help would be highly appreciated. Thanks in advance!
Some versions of Winamp and Microsoft Access set the description for the .mat file extension to "MATLAB Audio Format", although I have no idea what this means. It's unclear to me if such a unique file type really exists; I'd love to know more if there is actually some special format of which I am not aware. More likely, the file you downloaded is simply a standard MATLAB .mat file containing the EEG data in one or more variables. You can read the variables in MATLAB with the load command. To see the variable names contained in the MAT file prior to loading it, use whos with the -file switch.

How to read MP3 in MATLAB

I am currently working on watermarking audio files in Matlab for a mathematics research project. So far I have been able to read wav files using wavread in Matlab. However, because wav files are very large, the resulting data is also large. Therefore, in order to simplify this I would like to know how I would be able to read an mp3 file in Matlab. So far I have only tried to read an mp3 by using dsp.AudioFileReader. However, the resulting data only contains 0's and a few other numbers, which is clearly not the correct data. Would someone please be able to help me? Thank you so much!
you can use this code:
hfr = dsp.AudioFileReader('yourfile.mp3');
hplay = dsp.AudioPlayer('SampleRate',sample_rate_here);
 while ~isDone(hfr)
         audio = step(hfr);
         step(hplay, audio);
end

How to convert .hdr to .pfm with matlab?

Is there a way (or piece of code) that can convert the images that are in .hdr format to .pfm format?
I have a code that reads .pfm files but i want to make it run with .hdr files.
Converting .hdr files to .pfm on photoshop and reading next unfortunately is not an option.
Thanks for any help.
The the HDR Toolbox at www.advancedhdrbook.com or https://github.com/banterle/HDR_Toolbox/ has functions for reading and writing both .hdr and .pfm
There is also a high level function for writing and reading HDR Images: hdrimwrite and hdrimread