[Gate-users] merge mhd files

Andreas Resch andreas.resch at meduniwien.ac.at
Fri Apr 21 10:43:06 CEST 2017


Hi,

if you prefer a python or matlab script you can check out following:
https://github.com/andiresch/miscTools.git

the python script could be called like this:
find $(pwd) -name "myActor*.mhd" -exec python myPathTo/mergeMhD.py 
myActorMerged {} +

cheers,
andreas

Am 2017-04-20 22:06, schrieb G Tom:
> Thanks Simon,
> 
> Ill work on this tonight.
> 
> GT
> 
> On Thu, Apr 20, 2017 at 3:19 PM, Luc SIMON <uhqd75 at gmail.com> wrote:
> 
>> Dear all
>> I have a very very simple C code (attached) that merge to raw file
>> if they have the same size (then I just keep the header of one of
>> them for the merged file)
>> 
>> To compile :
>> 
>> gcc -c merge.c
>> 
>> gcc merge.o -o merge
>> 
>> Then
>> // Use : ./merge img1.raw img2.raw out.raw
>> // Add img1.raw and img2.raw in out.raw
>> 
>> Hereafter you ll find a part of a small bash script that loop in a
>> directory to merge many files...
>> 
>> # - - - - - - - - - - - - - - - - - -
>> # MERGING
>> 
>> # get name of the first file
>> file1=`ls -1 output/water/*doseW.raw | head -1`
>> mv $file1 output/water/first.raw
>> cp output/water/first.raw output/water/backUp.raw
>> 
>> varW=0
>> for file in output/water/*doseW.raw
>> do
>> varW=$((varW+1))
>> # merge first and next into out
>> output/water/merge $file output/water/first.raw
>> output/water/out.raw
>> # out become first
>> mv output/water/out.raw output/water/first.raw
>> done
>> varW=$((varW+1))
>> 
>> mv output/water/backUp.raw $file1
>> mv output/water/first.raw output/water/out.raw
>> 
>> # - - - - - - - - - - - - - - - - - -
>> 
>> Not perfect but it works for me
>> hope it helps
>> 
>> Luc SIMON
>> 
>> 2017-04-20 20:42 GMT+02:00 G Tom <gregthom992 at gmail.com>:
>> 
>>> Does anyone have a script to merge (mhd in particular or other
>>> files txt from dose actor)  files from several split simulations ?
>>> VV seems to only merge several nD into (n+1)D not several nD into
>>> nD.
>>> 
>>> Thanks
>>> 
>>> GT
>>> _______________________________________________
>>> Gate-users mailing list
>>> Gate-users at lists.opengatecollaboration.org
>>> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>>> [1]
>> 
>> --
>> 
>> ___________________
>> 
>> SIMON Luc, Physicien Médical, PhD
>> Département d'Ingénierie et de Physique Médicale - IUCT-Oncopole
>> - Toulouse, FRANCE
>> INSERM UMR 1037 (CRCT) - Equipe 15 - Toulouse, FRANCE
> 
> 
> 
> Links:
> ------
> [1] http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
> _______________________________________________
> Gate-users mailing list
> Gate-users at lists.opengatecollaboration.org
> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users


More information about the Gate-users mailing list