Home > bioelectromagnetism > getdicomsgui.m

getdicomsgui

PURPOSE ^

extension=char(input('What extension do you use in your image files?\nPlease type between single quotes (case sensitive)\n'))

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

extension=char(input('What extension do you use in your image files?\nPlease type between single quotes (case sensitive)\n'))

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %extension=char(input('What extension do you use in your image files?\nPlease type between single quotes (case sensitive)\n'))
0002 extension=evalin('base','extension');
0003 tofind=['.*\.' extension];
0004 
0005 tensorvol=[];
0006 changeto=(uigetdir);
0007 eval(['cd ' changeto ''])
0008 dicomdir=dir(changeto);
0009 dicomdir=struct2cell(dicomdir);
0010 dicomdir=dicomdir(1,:);
0011 dicomdir=dicomdir';
0012 %dicomdir=char(dicomdir);
0013 counter=0;
0014 
0015 
0016 for num=1:length(dicomdir)
0017     filename=char(dicomdir(num,:));
0018     f=regexp(filename,tofind);    
0019     if (f==1) 
0020         counter=counter+1;
0021         %st=char(st);
0022         ima=dicomread(filename);
0023         %eval (['slice' num2str(counter) '=ima']);
0024         disp(filename)
0025         tensorvol=cat(3,tensorvol,ima);
0026     end
0027 end
0028 disp('found')
0029 disp (counter)
0030 disp ('image files in this directory')
0031 %tensorvol=tensorvol';
0032 tensorvol=reshape(tensorvol,256,256,(counter/7),7);
0033 assignin('base','counter',counter)
0034 assignin('base','tensorvol',tensorvol)
0035 %disp ('they are now in a volume called tensorvol')
0036 
0037

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003