[Swift-devel] Re: arrays of structures and building them in SWIFT

Uri Hasson uhasson at gmail.com
Sun May 4 17:27:21 CDT 2008


Hi Ben, All,

I was thinking of something which Is along the lines of the solution you
mention:

I.e., I will have the files I need in a directory, and attempt to map via
regexp
E.g., if the directory contains

file1.Head file1.BRIK, file2.Head file2.BRIK

The mapper will map files to my complex type:
mytype t;
t[0].head = file1.HEAD
t[0].brik = file1.BRIK
t[1].head = file2.BRIK
t[1].brik = file2.BRIK
and I will be able to pass this to calls as MyCall(t[0])
[to the best of my understanding, I can achieve this now with csv mapper,
but not via any other way unless I write a custom mapper, java?]

But this doesn't take care of the other use of types that  I planned on,
which is using them as a placeholder for results of calls.
I,e., if a call generates a file4.HEAD and file4.BRIK file as output, it
would be nice to have the ability to say
mytpe result = MyCall(myarray[0])
and then automotatically get 'result' populated
result.head == HEAD result of MyCall
result.brik == BRIK result of MyCall

>From the viewpoint of the workflow, what this will look like is that the
functions took mytpe as input and gave mytype as output rather than specific
filenames.
I'm new to the SWIFT so might be confusing design principles.

Best,
Uri


On Sun, May 4, 2008 at 5:05 PM, Ben Clifford <benc at hawaga.org.uk> wrote:

>
> The v3 code probably has a very similar problem to that expressed in
> bug123, which I think is that mapper parameters don't interact in well
> with runtime constructed datasets.
>
> Perhaps this would be doable with a custom mapper that mapped an array inp
> declared as:
>
> type t { file head; file brik; }
> t inp[][];
>
> such that:
>
>  inputs/Snnnn.runbyrun.reg_TS_run-.rrrrrr+orig.sssss
>
> is mapped to:
>
>  inp[nnn][rrrr].sssss
>
> That is, rather than feeding list of nnn and rrr and then attempting to
> construct filenames, do it the other way round - use the presence of files
> in the input/ directory to cause a data structure to be constructed.
>
> That would be straightforward, I think, if you want to process all files
> that look like:
>
>  inputs/S*.runbyrun.reg_TS_run-*+orig.*
>
> rather than some subset of those.
>
> So one question is: do you want to process all files that look like:
>  inputs/S*.runbyrun.reg_TS_run-*+orig.*
> or do you want to process only a subset? And if so, what is the longer
> term goal for selecting the subset (you have "05" and 1 hard-coded at the
> moment, but I guess there's some intention to do otherwise eventually)
>
> On Sun, 4 May 2008, Mihael Hategan wrote:
>
> > Right. The problem here is that you can't reasonably "assign" file names
> > to data on the fly.
> >
> > How do your files look like? In other words, what are your input files?
> > (I get the ones in the graph, but you mention an array, so I figured
> > there's more).
> >
> > Mihael
> >
> > On Sun, 2008-05-04 at 11:54 -0500, Uri Hasson wrote:
> > > Hi Mihael,
> > >
> > > I'm trying to write an MRAC and so am finalizing up some swift
> > > routines...
> > >
> > > One thing I can't seem to manage is to declare a complex type that
> > > will contain two types (both of which are files), assign data to that
> > > type, and then pass that type to a call. I think my problem is that I
> > > don't know how to setup an array of structures and assign it values
> > > that are file locations.
> > >
> > > If you have a sec, could you advise on this?
> > > For starters, a graph of my current, nonelegant workflow can be seen
> > > in
> > >
> /disks/gpfs/fmri/cnari/swift/projects/uhasson/AFNIflows/SNR/snrgraph1.png
> > >
> > > and the script that generates it is:
> > >
> /disks/gpfs/fmri/cnari/swift/projects/uhasson/AFNIflows/SNR/AFNIsnrV2.swift
> > >
> > > All the procedures I write are very simple: they take *.HEAD and
> > > *.BRIK file pairs as input (a pair defines  a brain dataset), and
> > > output a *.HEAD and *.BRIK file as output.
> > >
> > > Now, Currently, I am stating each HEAD and BRIK file seperately as
> > > arguments, e.g., AFNI_mean (string baseName, file headFile, file
> > > brikFile ...)
> > >
> > > What I want to do is create a type like
> > > type AFNI_obj{
> > > file head;
> > > file brik;
> > > };
> > >
> > > assign the *.HEAD and *.BRIK file to that type and then pass that
> > > complex type like this: AFNI_mean (string baseName, AFNI_obj t, ...)
> > >
> > > I've tried doing this with Sarah, but we couldn't get it to work.
> > > If I do the csv mapper way, I can do it (AFNIsnrV4.swift in same dir)
> > > but if I try constructing the filenames on the fly within the script
> > > (feeble attempts in AFNIsnrV3.swift), it doesn't work.
> > >
> > > I think what I don't understand is how to manully set up an array of
> > > structures similarly to what the csv mapper does.
> > > If meeting in person is faster, would be very glad to meet.
> > >
> > > Any advice,
> > > Much appreciated.
> > >
> > > Uri
> > >
> >
> > _______________________________________________
> > Swift-devel mailing list
> > Swift-devel at ci.uchicago.edu
> > http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20080504/75728a57/attachment.html>


More information about the Swift-devel mailing list