Doxygen Source Code Documentation
WhichSubBricks.m
Go to the documentation of this file.00001 function [err, indx, SubLabel] = WhichSubBricks (InfoStat, Type, Label)
00002 %
00003 % [err, indx, SubLabel] = WhichSubBricks (InfoStat, Type, Label)
00004 %
00005 %Purpose:
00006 %
00007 %
00008 %
00009 %Input Parameters:
00010 %
00011 %
00012 %
00013 %Output Parameters:
00014 % err : 0 No Problem
00015 % : 1 Problems
00016 % indx: a vector containing sub-brick indices (+1 from AFNI indexing)
00017 % with labels containing both of Type and Label strings
00018 % SubLabel: a vector of structures containing the label strings.
00019 % For example if indx = [1 4] then the labels you were searching
00020 % for are SubLabel(1).str and SubLabel(4).str which correspond to
00021 % AFNI sub-bricks 0 and 3 in AFNI's indexing world.
00022 %
00023 %
00024 %Key Terms:
00025 %
00026 %More Info :
00027 %
00028 %
00029 %
00030 %
00031 % Author : Ziad Saad
00032 % Date : Fri Jul 18 16:56:58 EDT 2003
00033 % SSCC/NIMH/ National Institutes of Health, Bethesda Maryland
00034
00035
00036 %Define the function name for easy referencing
00037 FuncName = 'WhichSubBricks';
00038
00039 %Debug Flag
00040 DBG = 1;
00041
00042 %initailize return variables
00043 err = 1;
00044
00045 indx = zeros(1,InfoStat.DATASET_RANK(2));
00046
00047 %change the format of BRICK_LABS
00048 cend = 0;
00049 for (i=1:1:InfoStat.DATASET_RANK(2)),
00050 [err, SubLabel(i).str, cend] = NextString(InfoStat.BRICK_LABS,'~',cend+1);
00051 end
00052
00053 cnt = 0;
00054 for (i=1:1:InfoStat.DATASET_RANK(2)),
00055 if (~isempty(findstr(SubLabel(i).str, Label)) & ~isempty(findstr(SubLabel(i).str, Type))),
00056 cnt = cnt + 1;
00057 indx(cnt) = i;
00058 end
00059 end
00060
00061 if (cnt == 0), indx = [];
00062 else indx = indx(1:cnt);
00063 end
00064
00065
00066 err = 0;
00067 return;
00068