User Tools

Site Tools


processing_stream_-_image_file_conversion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
processing_stream_-_image_file_conversion [2010/05/26 17:23] – added the depth argument to findfiles jochenprocessing_stream_-_image_file_conversion [2010/05/26 17:35] – Yet another correction for the search folders... jochen
Line 34: Line 34:
  
 % find all folders that contain DICOM import files (sessions) % find all folders that contain DICOM import files (sessions)
-importdirs = findfiles([pwd '/CHIP*/func/raw'], '*', 'dirs=1', 'depth=1');+importdirs = findfiles([pwd '/CHIP*/raw'], '*r*', 'dirs=1', 'depth=1');
  
 % remove subjects that have already been imported % remove subjects that have already been imported
-donedirs = findfiles([pwd '/CHIP*/func'], 'run*', 'dirs=1', 'depth=1');+donedirs = findfiles([pwd '/CHIP*/func'], 'r*', 'dirs=1', 'depth=1');
 for dc = 1:numel(donedirs) for dc = 1:numel(donedirs)
  
     % take out those which match the CHIP* part     % take out those which match the CHIP* part
-    [study, chip] = fileparts(fileparts(donedirs{dc}));+    [study, chip] = fileparts(fileparts(fileparts(donedirs{dc})));
     importdirs(~isemptycell(regexp(importdirs, chip))) = [];     importdirs(~isemptycell(regexp(importdirs, chip))) = [];
 end end
Line 49: Line 49:
  
     % find dicom files     % find dicom files
-    dcmfiles = findfiles(importdirs{dc}, '*.dcm');+    dcmfiles = findfiles(importdirs{dc}, '*.dcm', 'depth=1');
          
     % no files, continue     % no files, continue
Line 58: Line 58:
     % figure out the target folder     % figure out the target folder
     [study, target] = fileparts(fileparts(dcmfiles{1}));     [study, target] = fileparts(fileparts(dcmfiles{1}));
 +    
 +    % re-vamp the target folder name (which for us is NUMVOLr_NUMSCAN)
 +    target_particles = regexp(target, '^(\d+)r_(\d+)$', 'tokens');
 +    if isempty(target_particles) || ...
 +        numel(target_particles{1}) ~= 2
 +        continue;
 +    end
 +    target = sprintf('r%02d_%03d', ...
 +        str2double(target_particles{1}{2}), ...
 +        str2double(target_particles{1}{1}));
          
     % create target folder     % create target folder
-    target = [fileparts(study) '/run_' target];+    target = [fileparts(study) '/func/' target];
     mkadir(target);     mkadir(target);
          
processing_stream_-_image_file_conversion.txt · Last modified: 2010/05/30 03:36 by jochen