8 |
|
|
9 |
structure Inputs : sig |
structure Inputs : sig |
10 |
|
|
11 |
|
(* |
12 |
datatype initialization |
datatype initialization |
13 |
= String of string |
= String of string |
14 |
| Bool of bool |
| Bool of bool |
16 |
| Real of FloatLit.float |
| Real of FloatLit.float |
17 |
| Tensor of int list * FloatLit.float vector |
| Tensor of int list * FloatLit.float vector |
18 |
| Seq of initialization list |
| Seq of initialization list |
19 |
| DynSeq of string |
*) |
20 |
|
datatype init_from_nrrd |
21 |
|
= DynSeq of string |
22 |
| Proxy of string * ImageInfo.info (* input image specified by proxy *) |
| Proxy of string * ImageInfo.info (* input image specified by proxy *) |
23 |
| Image of ImageInfo.info (* input image w/o proxy *) |
| Image of ImageInfo.info (* input image w/o proxy *) |
24 |
|
|
26 |
ty : 'ty, |
ty : 'ty, |
27 |
name : string, |
name : string, |
28 |
desc : string option, |
desc : string option, |
29 |
init : initialization option |
init : init_from_nrrd option |
30 |
} |
} |
31 |
|
|
32 |
val same : 'a input * 'a input -> bool |
val same : 'a input * 'a input -> bool |
33 |
|
|
34 |
val hash : 'a input -> word |
val hash : 'a input -> word |
35 |
|
|
36 |
val initToString : initialization -> string |
val initToString : init_from_nrrd -> string |
37 |
|
|
38 |
val toString : 'ty input -> string |
val toString : 'ty input -> string |
39 |
|
|
44 |
|
|
45 |
end = struct |
end = struct |
46 |
|
|
47 |
(* initialization of input variables *) |
(* |
48 |
datatype initialization |
datatype initialization |
49 |
= String of string |
= String of string |
50 |
| Bool of bool |
| Bool of bool |
52 |
| Real of FloatLit.float |
| Real of FloatLit.float |
53 |
| Tensor of int list * FloatLit.float vector |
| Tensor of int list * FloatLit.float vector |
54 |
| Seq of initialization list |
| Seq of initialization list |
55 |
| DynSeq of string |
*) |
56 |
| Proxy of string * ImageInfo.info |
datatype init_from_nrrd |
57 |
| Image of ImageInfo.info |
= DynSeq of string |
58 |
|
| Proxy of string * ImageInfo.info (* input image specified by proxy *) |
59 |
|
| Image of ImageInfo.info (* input image w/o proxy *) |
60 |
|
|
61 |
datatype 'ty input = INP of { |
datatype 'ty input = INP of { |
62 |
ty : 'ty, |
ty : 'ty, |
63 |
name : string, |
name : string, |
64 |
desc : string option, |
desc : string option, |
65 |
init : initialization option |
init : init_from_nrrd option |
66 |
} |
} |
67 |
|
|
68 |
fun same (INP{name=n1, ...}, INP{name=n2, ...}) = (n1 = n2) |
fun same (INP{name=n1, ...}, INP{name=n2, ...}) = (n1 = n2) |
69 |
|
|
70 |
fun hash (INP{name, ...}) = HashString.hashString name |
fun hash (INP{name, ...}) = HashString.hashString name |
71 |
|
|
72 |
|
(* |
73 |
fun initToString (String s) = String.concat["\"", String.toString s, "\""] |
fun initToString (String s) = String.concat["\"", String.toString s, "\""] |
74 |
| initToString (Bool b) = Bool.toString b |
| initToString (Bool b) = Bool.toString b |
75 |
| initToString (Int n) = if (n < 0) then "-" ^ IntInf.toString(~n) else IntInf.toString n |
| initToString (Int n) = if (n < 0) then "-" ^ IntInf.toString(~n) else IntInf.toString n |
79 |
| initToString (DynSeq name) = String.concat["load(\"", name, "\")"] |
| initToString (DynSeq name) = String.concat["load(\"", name, "\")"] |
80 |
| initToString (Proxy(name, _)) = String.concat["image(\"", name, "\")"] |
| initToString (Proxy(name, _)) = String.concat["image(\"", name, "\")"] |
81 |
| initToString (Image info) = ImageInfo.toString info |
| initToString (Image info) = ImageInfo.toString info |
82 |
|
*) |
83 |
|
fun initToString (DynSeq name) = String.concat["load(\"", name, "\")"] |
84 |
|
| initToString (Proxy(name, _)) = String.concat["image(\"", name, "\")"] |
85 |
|
| initToString (Image info) = ImageInfo.toString info |
86 |
|
|
87 |
fun toString (INP{name, desc=NONE, init=NONE, ...}) = name |
fun toString (INP{name, desc=NONE, init=NONE, ...}) = name |
88 |
| toString (INP{name, desc=SOME desc, init=NONE, ...}) = |
| toString (INP{name, desc=SOME desc, init=NONE, ...}) = |