/// <summary> /// Copies an existing layer into a FlexiLayer. /// </summary> /// <param name="ly">the original layer.</param> /// <param name="ds">the dataset to which the segments of this layer should be attached.</param> /// <remarks>The segments in the original dataset are copied to the new one, setting the LayerOwner and the position in the layer to the newly created object.</remarks> public Layer(SySal.TotalScan.Layer ly, SySal.TotalScan.Flexi.DataSet ds) : base() { m_Id = ly.Id; m_RefCenter = ly.RefCenter; m_BrickId = ly.BrickId; m_SheetId = ly.SheetId; m_Side = ly.Side; m_DownstreamZ = ly.DownstreamZ; m_UpstreamZ = ly.UpstreamZ; m_DownstreamZ_Updated = true; m_UpstreamZ_Updated = true; SetAlignmentData(ly.AlignData); m_RadiationLength = ly.RadiationLengh; m_UpstreamRadiationLength = ly.UpstreamRadiationLength; m_DownstreamRadiationLength = ly.DownstreamRadiationLength; int n = ly.Length; int i; Segments = new SySal.TotalScan.Segment[n]; for (i = 0; i < n; i++) { Segment seg = SySal.TotalScan.Flexi.Segment.Copy(ly[i], ds); seg.SetLayer(this, i); Segments[i] = seg; } }
/// <summary> /// Makes a copy of a segment, providing minimum functions of a SySal.TotalScan.Flexi.Segment. /// </summary> /// <param name="s">the segment to be copied.</param> /// <param name="ds">the dataset to assign the segment to.</param> /// <returns>the copy of the segment.</returns> public static SySal.TotalScan.Flexi.Segment Copy(SySal.TotalScan.Segment s, SySal.TotalScan.Flexi.DataSet ds) { if (s is SySal.TotalScan.Flexi.Segment) { SySal.TotalScan.Flexi.Segment ns = (s as SySal.TotalScan.Flexi.Segment).Clone() as SySal.TotalScan.Flexi.Segment; ns.DataSet = ds; return(ns); } return(new SySal.TotalScan.Flexi.Segment(s, ds)); }
/// <summary> /// Saves a TotalScan volume to a stream. /// </summary> /// <param name="w">the stream to save to.</param> public override void Save(System.IO.Stream w) { Type firsttype = null; int i, j; for (i = 0; i < m_Layers.Length && m_Layers[i].Length > 0; i++) { firsttype = m_Layers[i][0].Index.GetType(); break; } for (; i < m_Layers.Length && firsttype != null; i++) { for (j = 0; j < m_Layers[i].Length; j++) { if (m_Layers[i][j].Index.GetType() != firsttype) { firsttype = null; break; } } } if (firsttype == null) { for (i = 0; i < m_Layers.Length; i++) { for (j = 0; j < m_Layers[i].Length; j++) { ((SySal.TotalScan.Flexi.Segment)m_Layers[i][j]).SetIndex(new SySal.TotalScan.NullIndex()); } } } for (i = 0; i < m_Tracks.Length; i++) { SySal.TotalScan.Flexi.Track tk = (SySal.TotalScan.Flexi.Track)m_Tracks[i]; SySal.TotalScan.Flexi.DataSet ds = tk.DataSet; tk.SetAttribute(new SySal.TotalScan.NamedAttributeIndex(DataSetString + ds.DataType), ds.DataId); } base.Save(w); }
/// <summary> /// Imports a TotalScan Volume. /// </summary> /// <param name="ds">the dataset to which the volume to be imported belongs.</param> /// <param name="v">the volume to be imported.</param> /// <param name="fds">the dataset that should be imported; if this parameter is <c>null</c>, all datasets are imported.</param> /// <remarks>The dataset filter only applies to tracks and vertices. All segments are always imported. Track/Vertex dataset consistency should be guaranteed by the user.</remarks> public virtual void ImportVolume(DataSet ds, SySal.TotalScan.Volume v, DataSet fds) { System.Collections.ArrayList dsa = new System.Collections.ArrayList(); dsa.Add(ds); SySal.BasicTypes.Cuboid c = v.Extents; if (c.MinX < m_Extents.MinX) { m_Extents.MinX = c.MinX; } if (c.MaxX > m_Extents.MaxX) { m_Extents.MaxX = c.MaxX; } if (c.MinY < m_Extents.MinY) { m_Extents.MinY = c.MinY; } if (c.MaxY > m_Extents.MaxY) { m_Extents.MaxY = c.MaxY; } if (c.MinZ < m_Extents.MinZ) { m_Extents.MinZ = c.MinZ; } if (c.MaxZ > m_Extents.MaxZ) { m_Extents.MaxZ = c.MaxZ; } if (m_Layers.Length == 0) { m_RefCenter = v.RefCenter; } int i, j; Layer[] tl = new Layer[v.Layers.Length]; bool[] isnewlayer = new bool[v.Layers.Length]; int[] oldlength = new int[v.Layers.Length]; for (i = 0; i < v.Layers.Length; i++) { for (j = 0; j < Layers.Length && (Layers[j].BrickId != v.Layers[i].BrickId || Layers[j].SheetId != v.Layers[i].SheetId || Layers[j].Side != v.Layers[i].Side); j++) { ; } if (j == Layers.Length) { isnewlayer[i] = true; tl[i] = new Layer(v.Layers[i], ds); ((LayerList)m_Layers).Insert(tl[i]); } else { isnewlayer[i] = false; tl[i] = (SySal.TotalScan.Flexi.Layer)Layers[j]; oldlength[i] = tl[i].Length; SySal.TotalScan.Flexi.Segment[] segs = new SySal.TotalScan.Flexi.Segment[v.Layers[i].Length]; SySal.TotalScan.Layer li = v.Layers[i]; for (j = 0; j < segs.Length; j++) { segs[j] = SySal.TotalScan.Flexi.Segment.Copy(li[j], ds); //new SySal.TotalScan.Flexi.Segment(li[j], ds); } tl[i].Add(segs); } } Track[] tt = null;// = new Track[v.Tracks.Length]; System.Collections.ArrayList ato = new System.Collections.ArrayList(); int[] ixremap = new int[v.Tracks.Length]; for (i = 0; i < v.Tracks.Length; i++) { SySal.TotalScan.Track otk = v.Tracks[i]; if (otk is SySal.TotalScan.Flexi.Track) { if (fds != null && SySal.TotalScan.Flexi.DataSet.AreEqual(fds, ((SySal.TotalScan.Flexi.Track)otk).DataSet) == false) { ixremap[i] = -1; continue; } } ixremap[i] = m_Tracks.Length + i; Track tk = new Track(ds, ixremap[i]); SySal.TotalScan.Flexi.DataSet tds = null; if (otk is SySal.TotalScan.Flexi.Track) { tds = ((SySal.TotalScan.Flexi.Track)otk).DataSet; } SySal.TotalScan.Attribute[] a = otk.ListAttributes(); foreach (SySal.TotalScan.Attribute a1 in a) { if (tds == null && a1.Index is SySal.TotalScan.NamedAttributeIndex && ((SySal.TotalScan.NamedAttributeIndex)a1.Index).Name.StartsWith(DataSetString)) { tds = new DataSet(); tds.DataType = ((SySal.TotalScan.NamedAttributeIndex)a1.Index).Name.Substring(DataSetString.Length); tds.DataId = (long)a1.Value; } else { tk.SetAttribute(a1.Index, a1.Value); } } if (fds != null && (tds == null || SySal.TotalScan.Flexi.DataSet.AreEqual(fds, tds))) { tds = ds; } if (tds != null) { bool found = false; foreach (SySal.TotalScan.Flexi.DataSet dsi in dsa) { if (SySal.TotalScan.Flexi.DataSet.AreEqual(dsi, tds)) { tds = dsi; found = true; break; } } if (found == false) { dsa.Add(tds); } tk.DataSet = tds; } SySal.TotalScan.Flexi.Segment[] segs = new SySal.TotalScan.Flexi.Segment[otk.Length]; for (j = 0; j < segs.Length; j++) { if (otk[j].PosInLayer >= 0) { /* * segs[j] = (SySal.TotalScan.Flexi.Segment)v.Layers[otk[j].LayerOwner.Id][otk[j].PosInLayer]; * segs[j].DataSet = tk.DataSet; */ if (isnewlayer[otk[j].LayerOwner.Id]) { segs[j] = (SySal.TotalScan.Flexi.Segment)tl[otk[j].LayerOwner.Id][otk[j].PosInLayer]; } else { segs[j] = (SySal.TotalScan.Flexi.Segment)tl[otk[j].LayerOwner.Id][oldlength[otk[j].LayerOwner.Id] + otk[j].PosInLayer]; } segs[j].DataSet = tk.DataSet; } else { (segs[j] = SySal.TotalScan.Flexi.Segment.Copy(otk[j], tk.DataSet)).SetLayer(tl[otk[j].LayerOwner.Id], -1); tl[otk[j].LayerOwner.Id].Add(new SySal.TotalScan.Flexi.Segment[1] { segs[j] }); segs[j].DataSet = tk.DataSet; } } tk.AddSegments(segs); ato.Add(tk); } tt = (SySal.TotalScan.Flexi.Track [])ato.ToArray(typeof(SySal.TotalScan.Flexi.Track)); ato.Clear(); Vertex[] tv = null; // new Vertex[v.Vertices.Length]; for (i = 0; i < v.Vertices.Length; i++) { SySal.TotalScan.Vertex ovx = v.Vertices[i]; if (ovx is SySal.TotalScan.Flexi.Vertex) { if (fds != null && SySal.TotalScan.Flexi.DataSet.AreEqual(fds, ((SySal.TotalScan.Flexi.Vertex)ovx).DataSet) == false) { continue; } } Vertex vx = new Vertex(ds, m_Vertices.Length + i); SySal.TotalScan.Flexi.DataSet tds = null; if (ovx is SySal.TotalScan.Flexi.Vertex) { tds = ((SySal.TotalScan.Flexi.Vertex)ovx).DataSet; } SySal.TotalScan.Attribute[] a = ovx.ListAttributes(); foreach (SySal.TotalScan.Attribute a1 in a) { if (tds == null && a1.Index is SySal.TotalScan.NamedAttributeIndex && ((SySal.TotalScan.NamedAttributeIndex)a1.Index).Name.StartsWith(DataSetString)) { tds = new DataSet(); tds.DataType = ((SySal.TotalScan.NamedAttributeIndex)a1.Index).Name.Substring(DataSetString.Length); tds.DataId = (long)a1.Value; } else { vx.SetAttribute(a1.Index, a1.Value); } } if (fds != null && (tds == null || SySal.TotalScan.Flexi.DataSet.AreEqual(fds, tds))) { tds = ds; } if (tds != null) { bool found = false; foreach (SySal.TotalScan.Flexi.DataSet dsi in dsa) { if (SySal.TotalScan.Flexi.DataSet.AreEqual(dsi, tds)) { tds = dsi; found = true; break; } } if (found == false) { dsa.Add(tds); } vx.DataSet = tds; } for (j = 0; j < ovx.Length; j++) { SySal.TotalScan.Track otk = ovx[j]; if (ixremap[otk.Id] < 0) { break; } if (otk.Upstream_Vertex == ovx) { vx.AddTrack(tt[ixremap[otk.Id]], false); tt[ixremap[otk.Id]].SetUpstreamVertex(vx); } else { vx.AddTrack(tt[ixremap[otk.Id]], true); tt[ixremap[otk.Id]].SetDownstreamVertex(vx); } } if (j < ovx.Length) { continue; } vx.SetPos(ovx.X, ovx.Y, ovx.Z, ovx.DX, ovx.DY, ovx.AverageDistance); ato.Add(vx); } tv = (SySal.TotalScan.Flexi.Vertex[])ato.ToArray(typeof(SySal.TotalScan.Flexi.Vertex)); ato.Clear(); ixremap = null; ((TrackList)m_Tracks).Insert(tt); ((VertexList)m_Vertices).Insert(tv); }
public override string ToString() { SySal.TotalScan.Flexi.DataSet ds = ((SySal.TotalScan.Flexi.Track)Source.Track).DataSet; return "Tk " + Source.Track.Id + " " + ds.DataType + " " + ds.DataId; }
/// <summary> /// Adds segments, tracks and vertices of a volume to another one. /// </summary> /// <param name="refvol">the volume to be augmented with the content of the other.</param> /// <param name="addvol">segments, tracks and vertices from this volume are added to the other.</param> /// <param name="ds">the dataset that should be assigned to imported tracks.</param> /// <param name="fds">the dataset that should be imported; if this parameter is <c>null</c>, all datasets are imported.</param> /// <param name="flt">track mapping filter function.</param> /// <param name="logstrw">the stream where logging information is to be dumped; set to <c>null</c> to disable logging.</param> public void AddToVolume(SySal.TotalScan.Flexi.Volume refvol, SySal.TotalScan.Flexi.Volume addvol, SySal.TotalScan.Flexi.DataSet ds, SySal.TotalScan.Flexi.DataSet fds, MapManager.dMapFilter flt, System.IO.TextWriter logstrw) { if (logstrw != null) { logstrw.WriteLine("Begin AddToVolume."); } #if !DEBUG try { #endif int i, j, n; SySal.DAQSystem.Scanning.IntercalibrationInfo[] calinfo = new SySal.DAQSystem.Scanning.IntercalibrationInfo[addvol.Layers.Length]; for (i = 0; i < addvol.Layers.Length; i++) { for (j = 0; j < refvol.Layers.Length && (refvol.Layers[j].BrickId != addvol.Layers[i].BrickId || refvol.Layers[j].SheetId != addvol.Layers[i].SheetId || refvol.Layers[j].Side != addvol.Layers[i].Side); j++) { ; } if (j == refvol.Layers.Length) { throw new Exception("No reference layer found for Brick/Sheet/Side = " + addvol.Layers[i].BrickId + "/" + addvol.Layers[i].SheetId + "/" + addvol.Layers[i].Side); } if (logstrw != null) { logstrw.WriteLine("Seeking mapping for layer " + i + " Brick/Sheet/Side " + refvol.Layers[i].BrickId + "/" + refvol.Layers[i].SheetId + "/" + refvol.Layers[i].Side); } calinfo[i] = MapTransform(MapManager.ExtractMap(refvol.Layers[j], (MapSide)refvol.Layers[j].Side, flt, true), MapManager.ExtractMap(addvol.Layers[i], (MapSide)refvol.Layers[j].Side, flt, true), null, logstrw); } for (i = 0; i < addvol.Layers.Length; i++) { SySal.TotalScan.Layer lay = addvol.Layers[i]; n = lay.Length; SySal.DAQSystem.Scanning.IntercalibrationInfo cinfo = calinfo[i]; SySal.DAQSystem.Scanning.IntercalibrationInfo alinfo = new SySal.DAQSystem.Scanning.IntercalibrationInfo(); SySal.TotalScan.AlignmentData al = lay.AlignData; alinfo.MXX = al.AffineMatrixXX * cinfo.MXX + al.AffineMatrixXY * cinfo.MYX; alinfo.MXY = al.AffineMatrixXX * cinfo.MXY + al.AffineMatrixXY * cinfo.MYY; alinfo.MYX = al.AffineMatrixYX * cinfo.MXX + al.AffineMatrixYY * cinfo.MYX; alinfo.MYY = al.AffineMatrixYX * cinfo.MXY + al.AffineMatrixYY * cinfo.MYY; double rx = lay.RefCenter.X - cinfo.RX; double ry = lay.RefCenter.Y - cinfo.RY; alinfo.RX = lay.RefCenter.X; alinfo.RY = lay.RefCenter.Y; double dx = cinfo.MXX * rx + cinfo.MXY * ry - rx + cinfo.TX; double dy = cinfo.MYX * rx + cinfo.MYY * ry - ry + cinfo.TY; alinfo.TX = al.AffineMatrixXX * dx + al.AffineMatrixXY * dy + al.TranslationX; alinfo.TY = al.AffineMatrixYX * dx + al.AffineMatrixYY * dy + al.TranslationY; for (j = 0; j < n; j++) { SySal.TotalScan.Flexi.Segment seg = (SySal.TotalScan.Flexi.Segment)lay[j]; SySal.Tracking.MIPEmulsionTrackInfo info = seg.OriginalInfo; info.Slope = alinfo.Deform(info.Slope); info.Intercept = alinfo.Transform(info.Intercept); seg.SetInfo(info); } } if (logstrw != null) { logstrw.Write("Importing volume..."); } refvol.ImportVolume(ds, addvol, fds); if (logstrw != null) { logstrw.WriteLine("Done."); } #if !DEBUG } catch (Exception x) { if (logstrw != null) { logstrw.WriteLine("Error:\r\n" + x.ToString()); } } finally { if (logstrw != null) { logstrw.WriteLine("End AddToVolume."); } } #endif }
static void Main(string[] args) { bool postolDefined = false; bool slopetolDefined = false; bool mapsizeDefined = false; bool maxposoffsetDefined = false; bool minmatchesDefined = false; bool quickDefined = false; bool inputrefFileDefined = false; bool inputaddFileDefined = false; bool outputFileDefined = false; bool refdatasetDefined = false; bool adddatasetDefined = false; bool filterdatasetDefined = false; bool inputConfigDefined = false; bool logfileDefined = false; bool filterDefined = false; bool refbrickDefined = false; bool addbrickDefined = false; string FilterText = ""; string RefFileIn = ""; string AddFileIn = ""; string OutFile = ""; string RefDataSetName = ""; string AddDataSetName = ""; string FilterDataSetName = ""; string ConfigFile = ""; string LogFile = null; long RefBrick = 0; long AddBrick = 0; SySal.Processing.MapMerge.MapMerger MM = new SySal.Processing.MapMerge.MapMerger(); SySal.Processing.MapMerge.Configuration C = (SySal.Processing.MapMerge.Configuration)MM.Config; SySal.Processing.MapMerge.MapManager.dMapFilter Filter = null; try { int argnum; for (argnum = 0; argnum < args.Length; argnum++) { switch (args[argnum].ToLower()) { case swEditConfig: { System.Windows.Forms.Application.EnableVisualStyles(); System.Xml.Serialization.XmlSerializer xmls2 = new System.Xml.Serialization.XmlSerializer(typeof(SySal.Processing.MapMerge.Configuration)); try { C = (SySal.Processing.MapMerge.Configuration)xmls2.Deserialize(new System.IO.StringReader(System.IO.File.ReadAllText(args[argnum + 1]))); } catch (Exception) { }; SySal.Processing.MapMerge.EditConfigForm ec = new SySal.Processing.MapMerge.EditConfigForm(); ec.C = C; if (ec.ShowDialog() == DialogResult.OK) { System.IO.StringWriter w = new System.IO.StringWriter(); xmls2.Serialize(w, C); System.IO.File.WriteAllText(args[argnum + 1], w.ToString()); } return; } case swPosTol: { postolDefined = true; C.PosTol = System.Convert.ToDouble(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } case swSlopeTol: { slopetolDefined = true; C.SlopeTol = System.Convert.ToDouble(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } case swMaxOffset: { maxposoffsetDefined = true; C.MaxPosOffset = System.Convert.ToDouble(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } case swMapSize: { mapsizeDefined = true; C.MapSize = System.Convert.ToDouble(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } case swMinMatches: { minmatchesDefined = true; C.MinMatches = System.Convert.ToInt32(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } case swQuick: { quickDefined = true; break; } case swFilter: { filterDefined = true; FilterText = args[argnum + 1]; argnum++; break; } case swRefInput: { inputrefFileDefined = true; RefFileIn = args[argnum + 1]; argnum++; break; } case swAddInput: { inputaddFileDefined = true; AddFileIn = args[argnum + 1]; argnum++; break; } case swOutput: { outputFileDefined = true; OutFile = args[argnum + 1]; argnum++; break; } case swConfig: { inputConfigDefined = true; ConfigFile = args[argnum + 1]; argnum++; break; } case swRefDataSet: { refdatasetDefined = true; RefDataSetName = args[argnum + 1]; argnum++; break; } case swAddDataSet: { adddatasetDefined = true; AddDataSetName = args[argnum + 1]; argnum++; break; } case swFilterDataSet: { filterdatasetDefined = true; FilterDataSetName = args[argnum + 1]; argnum++; break; } case swLog: { logfileDefined = true; LogFile = args[argnum + 1]; argnum++; break; } case swRefBrick: { refbrickDefined = true; RefBrick = System.Convert.ToInt64(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } case swAddBrick: { addbrickDefined = true; AddBrick = System.Convert.ToInt64(args[argnum + 1], System.Globalization.CultureInfo.InvariantCulture); argnum++; break; } default: throw new Exception("Unsupported switch: \"" + args[argnum] + "\"."); } } if (quickDefined) { C.FavorSpeedOverAccuracy = true; } if (filterDefined) { Filter = new SySal.Processing.MapMerge.MapManager.dMapFilter(new ObjFilter(SegmentFilterFunctions, FilterText).Value); } if (inputConfigDefined) { System.Xml.Serialization.XmlSerializer xmls1 = new System.Xml.Serialization.XmlSerializer(typeof(SySal.Processing.MapMerge.Configuration)); System.IO.StreamReader r1 = new System.IO.StreamReader(ConfigFile); C = (SySal.Processing.MapMerge.Configuration)xmls1.Deserialize(r1); r1.Close(); } if (inputrefFileDefined == false) { throw new Exception("Reference volume must be defined."); } if (refdatasetDefined == false) { RefDataSetName = "TSR"; } if (inputaddFileDefined == false) { throw new Exception("Please define the volume to be imported."); } if (adddatasetDefined == false) { throw new Exception("Please define the dataset name to assign to imported data."); } if (outputFileDefined == false) { throw new Exception("The output file must be defined."); } } catch (Exception x) { Console.WriteLine("Usage: MapMerge.exe {parameters}"); Console.WriteLine("parameters"); Console.WriteLine(swPosTol + " -> position tolerance (optional)."); Console.WriteLine(swSlopeTol + " -> slope tolerance (optional)."); Console.WriteLine(swMapSize + " -> map size (optional)."); Console.WriteLine(swMaxOffset + " -> maximum position offset (optional)."); Console.WriteLine(swMinMatches + " -> minimum number of matches per map (optional)."); Console.WriteLine(swQuick + " -> favor speed over accuracy (optional)."); Console.WriteLine(swRefInput + " -> reference volume."); Console.WriteLine(swRefDataSet + " -> dataset name to assign to reference data (default is \"TSR\")."); Console.WriteLine(swRefBrick + " -> reset reference brick to specified brick number."); Console.WriteLine(swAddInput + " -> volume to import."); Console.WriteLine(swAddDataSet + " -> dataset name to assign to imported data."); Console.WriteLine(swFilterDataSet + " -> dataset name to filter imported data (leave blank for no filter)."); Console.WriteLine(swAddBrick + " -> reset brick to assign to imported data."); Console.WriteLine(swOutput + " -> output file name."); Console.WriteLine(swLog + " -> log file (optional) - use \"con\" for console output."); Console.WriteLine(swConfig + " -> configuration file (optional)."); Console.WriteLine(swFilter + " -> selection function for track matching (optional)."); Console.WriteLine(); Console.WriteLine("Variables that can be used for track filtering:"); foreach (FilterF ff in SegmentFilterFunctions) { Console.WriteLine(ff.Name + " -> " + ff.HelpText); } Console.WriteLine(); Console.WriteLine(x.ToString()); return; } System.IO.TextWriter logw = null; if (logfileDefined) { if (String.Compare(LogFile.Trim(), "con", true) == 0) { logw = Console.Out; } else { logw = new System.IO.StreamWriter(LogFile); } } MM.Config = C; SySal.TotalScan.NamedAttributeIndex.RegisterFactory(); SySal.TotalScan.BaseTrackIndex.RegisterFactory(); SySal.TotalScan.MIPMicroTrackIndex.RegisterFactory(); SySal.OperaDb.TotalScan.DBMIPMicroTrackIndex.RegisterFactory(); SySal.OperaDb.TotalScan.DBNamedAttributeIndex.RegisterFactory(); SySal.TotalScan.Flexi.Volume refv = new SySal.TotalScan.Flexi.Volume(); SySal.TotalScan.Flexi.DataSet rds = new SySal.TotalScan.Flexi.DataSet(); rds.DataId = RefBrick; rds.DataType = RefDataSetName; refv.ImportVolume(rds, (SySal.TotalScan.Volume)SySal.OperaPersistence.Restore(RefFileIn, typeof(SySal.TotalScan.Volume))); if (RefBrick > 0) { int n = refv.Layers.Length; int i; for (i = 0; i < n; i++) { if (refv.Layers[i].BrickId == 0) { ((SySal.TotalScan.Flexi.Layer)refv.Layers[i]).SetBrickId(RefBrick); } } } SySal.TotalScan.Flexi.DataSet ads = new SySal.TotalScan.Flexi.DataSet(); ads.DataId = AddBrick; ads.DataType = AddDataSetName; SySal.TotalScan.Flexi.DataSet fds = new SySal.TotalScan.Flexi.DataSet(); if (FilterDataSetName.Length > 0) { fds.DataId = AddBrick; fds.DataType = FilterDataSetName.Trim(); } else { fds = null; } SySal.TotalScan.Flexi.Volume addv = new SySal.TotalScan.Flexi.Volume(); addv.ImportVolume(ads, (SySal.TotalScan.Volume)SySal.OperaPersistence.Restore(AddFileIn, typeof(SySal.TotalScan.Volume)), fds); if (AddBrick > 0) { int n = addv.Layers.Length; int i; for (i = 0; i < n; i++) { if (addv.Layers[1].BrickId == 0) { ((SySal.TotalScan.Flexi.Layer)addv.Layers[i]).SetBrickId(AddBrick); } } } MM.AddToVolume(refv, addv, ads, null, Filter, logw); if (logw != null && logw != Console.Out) { logw.Flush(); logw.Close(); logw = null; } Console.WriteLine("Result written to " + SySal.OperaPersistence.Persist(OutFile, refv)); }