コード例 #1
0
        public void LoadColorMap(string file)
        {
            _modelState.ColorMap.Param = "";
            IColorMap cm = ColorMapFactory.FromFile(file);

            if (cm != null)
            {
                _modelState.ColorMap.Type = cm.Type;
                if (CurrentImage != null)
                {
                    CurrentImage.ColorMap = cm;
                    RaiseImageChanged();
                }
            }
        }
コード例 #2
0
        static public IImage FromFile(string nicFile)
        {
            IImage       ii  = null;
            StreamReader sr  = null;
            XmlReader    r   = null;
            ImageTypes   it  = ImageTypes.Indexed;
            Color        nan = Color.Empty;

            try
            {
                sr = new StreamReader(nicFile);
                r  = XmlReader.Create(sr.BaseStream);
                r.ReadToFollowing("ImageConfig");
                it             = (ImageTypes)Enum.Parse(typeof(ImageTypes), r["Type"]);
                nan            = Color.FromArgb(int.Parse(r["NaNColor"]));
                r.Close(); r   = null;
                sr.Close(); sr = null;
                IColorTable ct = ColorTableFactory.FromFile(nicFile);
                IColorMap   cm = ColorMapFactory.FromFile(nicFile);
                ii = ImageFactory.Create(it);
                if (ii != null)
                {
                    ii.ColorTable             = ct;
                    ii.ColorMap               = cm;
                    ii.InvalidPixelValueColor = nan;
                }
            }
            finally
            {
                if (r != null)
                {
                    r.Close();
                }
                if (sr != null)
                {
                    sr.Close();
                }
            }

            return(ii);
        }