void UseRevisedSwc() { Debug.Assert(param.revisedSwc != null); //SWCの読み込み ShowMessageWithoutNewline("load from swc... "); var io = new DendriteIO(); var swc = io.LoadFromSWC(param.revisedSwc); ShowTimeConsumption(); //主枝の抽出 ShowMessageWithoutNewline("extracting main dendrite... "); ip.ExtractMainDendrite(); ShowTimeConsumption(); //側枝の抽出 ShowMessageWithoutNewline("extracting sub dendrites... "); ip.ExtractSubDendrites(); ShowTimeConsumption(); // swcファイルのノードとmain_dendrite, sub_dendriteを対応付ける ShowMessageWithoutNewline("relate swc node to images... "); ip.RelateSwcNode(swc); ShowTimeConsumption(); //補間するか否か if (param.interporation) { //側枝の接続 ShowMessageWithoutNewline("connecting sub dendrites to main dendrite... "); ip.ConnectSubDendritesToMainDendrite(); ShowTimeConsumption(); // 側枝と側枝を接続するか? if (param.outputSub && param.combinateSubDendrites) { ShowMessageWithoutNewline("connecting sub dendrites to other sub dendrites... "); ip.ConnectSubDendritesToOtherSubDendrites(); ShowTimeConsumption(); } } }
private void OutputSubDendrite() { DendriteIO io = new DendriteIO(); string rawFilename = Path.GetFileNameWithoutExtension(param.ofname); string dirname = Path.Combine(Path.GetDirectoryName(param.ofname), rawFilename + "-sub"); if (Directory.Exists(dirname)) { Directory.Delete(dirname, true); } Directory.CreateDirectory(dirname); // 出力するファイル名の末尾の桁数 // ファイル名は0オリジンにするので .Count - 1 にしている int digit = (NotMergedSubDendritesIdx.Count - 1).ToString().Length; // 出力するファイル名の末尾のID int sub_dendrite_id = 0; // 独立して存在している(他のノードに併合されていない)側枝ノードを、体積降順で並べ替える var orderByVolume = NotMergedSubDendritesIdx.OrderByDescending(x => sub_dendrites_volume[x]); foreach (int sub_index in orderByVolume) { Dendrite sdendrite = sub_dendrites[sub_index]; IList <DendriteNode> edge = sdendrite.GetEdgeNodes(); sdendrite.ChangeRootNode(edge[0]); string filename = CreateFileNameForSubDendriteIO(dirname, digit, sub_dendrite_id); string path = Path.Combine(dirname, filename); io.SaveToSWC(path, sdendrite); sub_dendrite_id++; if (param.outputVTK) { string vtkFilename = Path.ChangeExtension(filename, "vtk"); string vtkPath = Path.Combine(dirname, vtkFilename); VtkWriter.SaveToVTKLegacy(vtkPath, sdendrite); } } }
/// <summary> /// 樹状突起構造をswcファイルに出力 /// </summary> public void OutputDendrite() { DendriteIO io = new DendriteIO(); IList <DendriteNode> edge = main_dendrite.GetEdgeNodes(); main_dendrite.ChangeRootNode(edge.First()); SetSwcHeader(main_dendrite); io.SaveToSWC(param.ofname, main_dendrite); if (param.outputVTK) { string vtkFilename = Path.ChangeExtension(param.ofname, "vtk"); VtkWriter.SaveToVTKLegacy(vtkFilename, main_dendrite); } // sub_dendritesについても出力する(sub_dendritesのスムージング、ひげの除去には未対応) if (param.outputSub) { OutputSubDendrite(); } }
void UseRevisedSwc() { Debug.Assert(param.revisedSwc != null); //SWCの読み込み ShowMessageWithoutNewline("load from swc... "); var io = new DendriteIO(); var swc = io.LoadFromSWC(param.revisedSwc); ShowTimeConsumption(); //主枝の抽出 ShowMessageWithoutNewline("extracting main dendrite... "); ip.ExtractMainDendrite(); ShowTimeConsumption(); //側枝の抽出 ShowMessageWithoutNewline("extracting sub dendrites... "); ip.ExtractSubDendrites(); ShowTimeConsumption(); // swcファイルのノードとmain_dendrite, sub_dendriteを対応付ける ShowMessageWithoutNewline("relate swc node to images... "); ip.RelateSwcNode(swc); ShowTimeConsumption(); //補間するか否か if (param.interporation) { //側枝の接続 ShowMessageWithoutNewline("connecting sub dendrites to main dendrite... "); ip.ConnectSubDendritesToMainDendrite(); ShowTimeConsumption(); // 側枝と側枝を接続するか? if (param.outputSub && param.combinateSubDendrites) { ShowMessageWithoutNewline("connecting sub dendrites to other sub dendrites... "); ip.ConnectSubDendritesToOtherSubDendrites(); ShowTimeConsumption(); } } }