[Gate-users] merge mhd files

Luc SIMON uhqd75 at gmail.com
Thu Apr 20 21:19:54 CEST 2017


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
>



-- 
___________________

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20170420/eb873ba2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge.c
Type: text/x-csrc
Size: 791 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20170420/eb873ba2/attachment.c>


More information about the Gate-users mailing list