Re: [fluka-discuss]: RE: phantom problem - fortran code

From: Paola Sala <paola.sala_at_mi.infn.it>
Date: Tue, 9 Oct 2018 15:44:01 +0200

Hello
the code you attached reads the file, does not write it back. The values
are stored in the noid array
One has to add the part to write, something like

     open (20,file='AFnew.dat')
      do 400 nsl=1,nsli

          do 401 nr=1,nrow
             write (20,*) (noid(nc,nr,nsl),i=1,ncol)
          401 continue
      400 continue
      close (20)
( please check that this is the format expected by imageJ)
Cheers
Paola




> Hello again
>
> Maybe my problem is not so relevant to Fluka as it more abour
> fortran...but I have the problem finding the live fortran-related forums.
> Do you have any suggestions maybe?
>
> Regards
> A.
>
> From: owner-fluka-discuss_at_mi.infn.it <owner-fluka-discuss_at_mi.infn.it> On
> Behalf Of Ševcik Aleksandras
> Sent: Sunday, October 7, 2018 11:45
> To: fluka-discuss_at_fluka.org
> Subject: [fluka-discuss]: phantom problem - fortran code
>
> Dear experts,
>
> Despite that I have been able to successfully convert icrp phantom to
> fluka vxl and it works with some correction, I still need to understand
> one tricky moment here which, unfortunately, could not being solved by my
> own for a long time.
> In the ICRP's data readme.txt states the following, see below. My problem
> is that I cannot open original .dat file with imageJ with parameters col
> 299 row137 sli348 which means that original .dat file is not build in such
> way so it must be altered as readme.txt states. I can understand basically
> what this code tries to do, and I can successfully compile and run it,
> however, nothing changes in that .dat file, i.e. it is not stored in the
> (299x137x348) array! Does this code lacks some output parameter or smth?
>
> "The organ identification numbers are stored in portions of 16, but the
> number of columns is not a multiple of 16. Therefore, appropriate care has
> to be applied for reading the data. As an example, a FORTRAN programme
> that reads the data of the female reference computational phantom and
> stores them into a (299 x 137 x 348) array is given in the following:
>
> program readdata
> * Programme to read the voxel phantom data from ASCII file
> * AF.dat and store them in a three-dimensional array of
> * organ identification numbers
> dimension norgin(300),nodum(16),noid(300,200,350)
> * Number of columns, rows and slices:
> ncol=299
> nrow=137
> nsli=348
> open (10,file='AF.dat')
> * Read phantom file, assign organ identification numbers to
> * array positions
> * The organ identification numbers are stored in portions of 16,
> * but the number of columns is not a multiple of 16.
> * Therefore, when ncol OIDs are read, this ends right in the
> * middle of a line, and the rest is ignored. Therefore, the next
> * "read" statement has to account for this; the last line that
> * has been read only partially, has to be read again, whereby
> * that first part that has been registered already needs to be
> * skipped. Therefore, the number "ndum" of these items has to be
> * tracked.
> write (6,'('' Reading of phantom file started'')')
> nrorea=ncol/16
> ndifcol=ncol-16*nrorea
> ndum=0
> do 40 nsl=1,nsli
> do 40 nr=1,nrow
> if (ndum.ne.0) then
> backspace (10)
> read (10,*) (nodum(i),i=1,ndum), (norgin(i),i=1,ncol)
> else
> read (10,*) (norgin(i),i=1,ncol)
> endif
> do 30 nc=1,ncol
> noid(nc,nr,nsl)=norgin(nc)
> 30 continue
> ndum=ndum+ndifcol
> if (ndum.ge.16) ndum=ndum-16
> 40 continue
> write (6,'('' ... finished'')')
> close (10)
> end"
>


Paola Sala
INFN Milano
tel. Milano +39-0250317374
tel. CERN +41-227679148

__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Tue Oct 09 2018 - 16:48:14 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 09 2018 - 16:48:26 CEST