Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/fields/image-info.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/fields/image-info.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 239, Fri Aug 6 00:36:04 2010 UTC revision 394, Thu Oct 14 16:30:29 2010 UTC
# Line 8  Line 8 
8    
9  structure ImageInfo : sig  structure ImageInfo : sig
10    
11      (* Image samples are tensors of some raw representation type *)
12        type sample_ty = (int list * RawTypes.ty)
13    
14      datatype info = ImgInfo of {      datatype info = ImgInfo of {
15              id : OS.FileSys.file_id,            (* ID of image file *)              id : OS.FileSys.file_id,            (* ID of image file *)
16              dim : int,                          (* dimension of space *)              dim : int,                          (* dimension of space *)
17              ty : RawTypes.ty,                   (* types of scalar samples *)              ty : sample_ty,                     (* types of image samples *)
18              origin : FloatLit.float list,       (* center of first sample *)              origin : FloatLit.float list,       (* center of first sample *)
19              sizes : int list                    (* number of samples along each axis *)              sizes : int list                    (* number of samples along each axis *)
20            }            }
# Line 26  Line 29 
29      val getInfo : string -> info      val getInfo : string -> info
30    
31      val toString : info -> string      val toString : info -> string
32        val dim : info -> int                       (* dimension of space *)
33    
34    end = struct    end = struct
35    
36      (* Image samples are tensors of some raw representation type *)
37        type sample_ty = (int list * RawTypes.ty)
38    
39      datatype info = ImgInfo of {      datatype info = ImgInfo of {
40              id : OS.FileSys.file_id,            (* ID of image file *)              id : OS.FileSys.file_id,            (* ID of image file *)
41              dim : int,                          (* dimension of space *)              dim : int,                          (* dimension of space *)
42              ty : RawTypes.ty,                   (* types of scalar samples *)              ty : sample_ty,                     (* types of image samples *)
43              origin : FloatLit.float list,       (* center of first sample *)              origin : FloatLit.float list,       (* center of first sample *)
44              sizes : int list                    (* number of samples along each axis *)              sizes : int list                    (* number of samples along each axis *)
45            }            }
# Line 47  Line 54 
54            fun set (r, v) = (r := SOME v)            fun set (r, v) = (r := SOME v)
55            fun get (tag, r) = (case !r of NONE => raise Fail("missing "^tag) | SOME v => v)            fun get (tag, r) = (case !r of NONE => raise Fail("missing "^tag) | SOME v => v)
56            val ty = ref NONE            val ty = ref NONE
57              val totalDim = ref NONE
58            val dim = ref NONE            val dim = ref NONE
59            fun doValue ("type", v) = set(ty, RawTypes.fromString v)            fun doValue ("type", v) = set(ty, RawTypes.fromString v)
60              | doValue ("dimension", v) = ()              | doValue ("dimension", v) = set (totalDim, valOf(Int.fromString v))
61              | doValue ("space dimension", v) = set (dim, valOf(Int.fromString v))              | doValue ("space dimension", v) = set (dim, valOf(Int.fromString v))
62              | doValue ("sizes", v) = ()              | doValue ("sizes", v) = ()
63              | doValue ("space directions", v) = ()              | doValue ("space directions", v) = ()
# Line 65  Line 73 
73              ImgInfo{              ImgInfo{
74                  id = OS.FileSys.fileId fileName,                  id = OS.FileSys.fileId fileName,
75                  dim = get ("space dimension", dim),                  dim = get ("space dimension", dim),
76                  ty = get ("type", ty),  (* FIXME: in general, the type is a tensor of raw values *)
77                    ty = ([], get ("type", ty)),
78                  origin = [],    (* FIXME *)                  origin = [],    (* FIXME *)
79                  sizes = []      (* FIXME *)                  sizes = []      (* FIXME *)
80                }                }
81            end            end
82    
83      fun toString (ImgInfo{...}) = "IMAGE" (* FIXME *)      fun toString (ImgInfo{dim, ...}) = concat["IMAGE", Int.toString dim, "D"] (* FIXME *)
84    
85        fun dim (ImgInfo{dim, ...}) = dim
86    
87    end    end

Legend:
Removed from v.239  
changed lines
  Added in v.394

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0