8 |
|
|
9 |
structure ImageInfo : sig |
structure ImageInfo : sig |
10 |
|
|
11 |
type info = { |
datatype info = ImgInfo of { |
12 |
|
id : OS.FileSys.file_id, (* ID of image file *) |
13 |
dim : int, (* dimension of space *) |
dim : int, (* dimension of space *) |
14 |
ty : RawTypes.ty, (* types of scalar samples *) |
ty : RawTypes.ty, (* types of scalar samples *) |
15 |
origin : FloatLit.float list, (* center of first sample *) |
origin : FloatLit.float list, (* center of first sample *) |
16 |
sizes : int list (* number of samples along each axis *) |
sizes : int list (* number of samples along each axis *) |
17 |
} |
} |
18 |
|
|
19 |
|
(* are the underlying files the same? *) |
20 |
|
val same : info * info -> bool |
21 |
|
|
22 |
|
(* hash value (based on image file ID) *) |
23 |
|
val hash : info -> word |
24 |
|
|
25 |
|
(* get image info from a Nrrd file *) |
26 |
val getInfo : string -> info |
val getInfo : string -> info |
27 |
|
|
28 |
end = struct |
end = struct |
29 |
|
|
30 |
type info = { |
datatype info = ImgInfo of { |
31 |
|
id : OS.FileSys.file_id, (* ID of image file *) |
32 |
dim : int, (* dimension of space *) |
dim : int, (* dimension of space *) |
33 |
ty : RawTypes.ty, (* types of scalar samples *) |
ty : RawTypes.ty, (* types of scalar samples *) |
34 |
origin : FloatLit.float list, (* center of first sample *) |
origin : FloatLit.float list, (* center of first sample *) |
35 |
sizes : int list (* number of samples along each axis *) |
sizes : int list (* number of samples along each axis *) |
36 |
} |
} |
37 |
|
|
38 |
|
fun same (ImgInfo{id=a, ...}, ImgInfo{id=b, ...}) = (a = b) |
39 |
|
|
40 |
|
fun hash (ImgInfo{id, ...}) = OS.FileSys.hash id |
41 |
|
|
42 |
fun getInfo fileName = let |
fun getInfo fileName = let |
43 |
val {version, header} = RunDNorm.run fileName |
val {version, header} = RunDNorm.run fileName |
44 |
in |
in |