I have a dataset which needs to be renamed.
The structurre of folder is as follows.
D:\XXXX\Control\PPMI\3104\MPRAGE_GRAPPA\2011-08-01_13_30_13.0\S120955\######.dcm
S120955 folder needs to changed as 3104 [great grandparent folder name]

Thanks a lot...
Code: Select all
$firstSub = gpc($item, "component", -($cntRootSep +1));$firstSub = gpc($item, "component", -($cntSep - $cntRootSep));