diff --git a/COMMON/DeformationStrokes.cpp b/COMMON/DeformationStrokes.cpp index 0856422..5918765 100644 --- a/COMMON/DeformationStrokes.cpp +++ b/COMMON/DeformationStrokes.cpp @@ -32,6 +32,11 @@ void DeformationStrokes::AddNewStroke() m_selected_stroke_idx = static_cast(m_strokes.size()) - 1; } +void DeformationStrokes::AddNewStroke(const Stroke& newstroke) +{ + m_strokes.push_back(newstroke); + m_selected_stroke_idx = static_cast(m_strokes.size()) - 1; +} void DeformationStrokes::ClearAllStrokes() { @@ -89,6 +94,15 @@ int DeformationStrokes::GetStrokePlaneXYZ(const int _idx) } + +bool DeformationStrokes::GetStrokeNormalsSide(const int _idx) +{ + if (_idx < 0 || _idx >= m_strokes.size()) return false; + return m_strokes[_idx].GetNormalSide(); +} + + + bool DeformationStrokes::AddCP_SelStroke(const EVec3f& _pos) { if (m_selected_stroke_idx == -1) @@ -103,6 +117,21 @@ bool DeformationStrokes::AddCP_SelStroke(const EVec3f& _pos) +bool DeformationStrokes::AddCP_SelStroke(const EVec3f& _pos, const EVec3f& _nearest_vertex_normal) +{ + if (m_selected_stroke_idx == -1) + { + AddNewStroke(); + } + + if (m_strokes[m_selected_stroke_idx].m_shared_idx != -1) return false; + + return m_strokes[m_selected_stroke_idx].AddNewCP(_pos, _nearest_vertex_normal); + +} + + + int DeformationStrokes::PickCPs( const EVec3f& _ray_pos, const EVec3f& _ray_dir, @@ -189,6 +218,11 @@ void DeformationStrokes::UnlockAllStrokes() void DeformationStrokes::MakeShare_SelStroke(const int new_shared_idx) { if (m_selected_stroke_idx == -1) return ; + if (!m_strokes[m_selected_stroke_idx].GetNormalSide()) + { + m_strokes[m_selected_stroke_idx].ReverseStrokeAndCps(); + m_strokes[m_selected_stroke_idx].FlipNormal(); + } m_strokes[m_selected_stroke_idx].m_is_shared = true; m_strokes[m_selected_stroke_idx].m_shared_idx = new_shared_idx; m_strokes[m_selected_stroke_idx].m_is_locked = true; @@ -319,8 +353,32 @@ bool DeformationStrokes::bSelStrokeShared() +void DeformationStrokes::FlipSelNormals() +{ + if (m_selected_stroke_idx == -1) return; + m_strokes[m_selected_stroke_idx].FlipNormal(); +} +DeformationStrokes::Stroke DeformationStrokes::CloneSelStroke() +{ + Stroke newstroke = m_strokes[m_selected_stroke_idx]; + return newstroke; +} +void DeformationStrokes::CleanStrokesNormalsSide() +{ + const int size = static_cast(m_strokes.size()); + for (int i = 0; i < size; ++i) + { + if (!m_strokes[i].GetNormalSide()) + { + m_strokes[i].ReverseStrokeAndCps(); + m_strokes[i].FlipNormal(); + } + } +} + + -void DeformationStrokes::DrawStrokes(const bool& _only_selected_stroke) const +void DeformationStrokes::DrawStrokes(const bool& _only_selected_stroke, const bool& _show_nowrmals) const { const int size = static_cast(m_strokes.size()); for (int i = 0; i < size; ++i) @@ -328,7 +386,7 @@ void DeformationStrokes::DrawStrokes(const bool& _only_selected_stroke) const if (_only_selected_stroke && (m_selected_stroke_idx != -1) && (m_selected_stroke_idx != i)) continue; const bool flag = (m_selected_stroke_idx == i); - m_strokes[i].DrawStroke(flag); + m_strokes[i].DrawStroke(flag,_show_nowrmals); } } @@ -383,6 +441,7 @@ DeformationStrokes::Stroke::Stroke() { m_stroke.clear(); m_cps.clear(); + m_normal_side = true; m_selected_cpid = -1; m_plane_xyz = -1; m_plane_pos = -1.0f; @@ -436,6 +495,8 @@ bool DeformationStrokes::Stroke::AddNewCP(const EVec3f _pos) m_selected_cpid = num_cps; m_plane_xyz = xyz; m_plane_pos = m_cps[0][xyz]; + + EVec3f tangent = (m_cps[1] - m_cps[0]).normalized(); UpdateStroke(); return true; } @@ -489,6 +550,95 @@ bool DeformationStrokes::Stroke::AddNewCP(const EVec3f _pos) } + +bool DeformationStrokes::Stroke::AddNewCP(const EVec3f _pos, const EVec3f& _nearest_vertex_normal) +{ + //can not add to shared curve + if (m_shared_idx != -1) return false; + const int num_cps = static_cast(m_cps.size()); + + if (num_cps == 0) + { + m_cps.push_back(_pos); + m_selected_cpid = num_cps; + UpdateStroke(); + return true; + } + + if (num_cps == 1) + { + int xyz = (fabsf(m_cps[0][0] - _pos[0]) < 0.001f) ? 0 : + (fabsf(m_cps[0][1] - _pos[1]) < 0.001f) ? 1 : + (fabsf(m_cps[0][2] - _pos[2]) < 0.001f) ? 2 : -1; + if (xyz == -1) return false; + + m_cps.push_back(_pos); + m_selected_cpid = num_cps; + m_plane_xyz = xyz; + m_plane_pos = m_cps[0][xyz]; + + const EVec3f tangent = (m_cps[1] - m_cps[0]).normalized(); + const EVec3f plane_normal = EVec3f( + m_plane_xyz == 0 ? 1.0f : 0.0f, + m_plane_xyz == 1 ? 1.0f : 0.0f, + m_plane_xyz == 2 ? 1.0f : 0.0f + ); + const EVec3f stroke_normal = (plane_normal.cross(tangent)).normalized(); + m_normal_side = (_nearest_vertex_normal.dot(stroke_normal) > 0.0f) ? true : false; + UpdateStroke(); + return true; + } + + // cp size >= 2 + if (fabsf(m_plane_pos - _pos[m_plane_xyz]) > 0.001f) return false; + + if (num_cps == 2) + { + m_cps.push_back(_pos); + m_selected_cpid = num_cps; + UpdateStroke(); + return true; + } + + // cp size >= 3 + //compute distance from the center of polyline + float min_dist = (_pos - m_cps[0]).norm(); + int insert_idx = 0; + + for (int i = 0; i < num_cps - 1; ++i) + { + const EVec3f cent = (m_cps[i] + m_cps[i + 1]) / 2; + const float dist = (_pos - cent).norm(); + + if (dist < min_dist) + { + min_dist = dist; + insert_idx = i + 1; + } + } + + const float dist_end = (_pos - m_cps[num_cps - 1]).norm(); + if (dist_end < min_dist) + { + min_dist = dist_end; + insert_idx = num_cps; + } + m_cps.insert(m_cps.begin() + insert_idx, _pos); + m_selected_cpid = insert_idx; + + UpdateStroke(); + + if (m_debug) + { + std::cout << "Add cp: " << m_cps.size() << " cps.\n"; + std::cout << _pos << "\n"; + } + + return true; +} + + + void DeformationStrokes::Stroke::MoveSelectedCP(const EVec3f& _pos) { if (m_selected_cpid == -1) return; @@ -535,6 +685,19 @@ int DeformationStrokes::Stroke::PickCPs( } + +void DeformationStrokes::Stroke::FlipNormal() +{ + m_normal_side = m_normal_side ? false : true; +} + +void DeformationStrokes::Stroke::ReverseStrokeAndCps() +{ + std::reverse(m_cps.begin(), m_cps.end()); + std::reverse(m_stroke.begin(), m_stroke.end()); +} + + void DeformationStrokes::Stroke::UpdateStroke() { if (m_cps.size() < 3) return; @@ -552,7 +715,9 @@ void DeformationStrokes::Stroke::UpdateStroke() stroke_2f = KCurves::CalcKCurvesOpen(cps_2f); //failed - if (stroke_2f.size() == 0) return; + if (stroke_2f.size() == 0) { std::cout << "x"; return; } + + std::cout << "o"; // convert stroke: EVec2f to EVec3f m_stroke.clear(); @@ -568,12 +733,13 @@ void DeformationStrokes::Stroke::UpdateStroke() } + static const EVec3f COLOR_R = { 1.0f, 0.0f, 0.0f }; static const EVec3f COLOR_Y = { 1.0f, 1.0f, 0.0f }; static const EVec3f COLOR_G = { 0.0f, 1.0f, 0.0f }; static const EVec3f COLOR_A = { 0.0f, 1.0f, 1.0f }; -void DeformationStrokes::Stroke::DrawStroke(const bool& _is_selected) const +void DeformationStrokes::Stroke::DrawStroke(const bool& _is_selected, const bool& _show_nowrmals) const { if (m_stroke.size() == 0) return; @@ -582,6 +748,47 @@ void DeformationStrokes::Stroke::DrawStroke(const bool& _is_selected) const m_is_locked ? COLOR_G : COLOR_A; DrawPolyLine(color, _is_selected ? 1.5f * 6 : 1.0f * 6, m_stroke, false); + + if (_show_nowrmals) { + glDisable(GL_LIGHTING); + glColor3f(0.0f, 1.0f, 1.0f); + glLineWidth(_is_selected ? 1.5f * 6 : 1.0f * 6); + + const float normal_length = 1.0f; + + EVec3f previous_draw_normal = EVec3f(0.0f, 0.0f, 0.0f); + + const EVec3f plane_normal = EVec3f( + m_plane_xyz == 0 ? 1.0f : 0.0f, + m_plane_xyz == 1 ? 1.0f : 0.0f, + m_plane_xyz == 2 ? 1.0f : 0.0f + ); + + glBegin(GL_LINES); + for (size_t i = 0; i < m_stroke.size(); ++i) + { + EVec3f tangent; + if (i == 0) tangent = m_stroke[i + 1] - m_stroke[i]; + else if (i == m_stroke.size() - 1) tangent = m_stroke[i] - m_stroke[i - 1]; + else tangent = m_stroke[i + 1] - m_stroke[i - 1]; + tangent.normalize(); + + EVec3f draw_normal = plane_normal.cross(tangent); + draw_normal.normalize(); + + if (i == 0) previous_draw_normal = draw_normal; + else + { + if (previous_draw_normal.dot(draw_normal) < 0.0f) draw_normal = -draw_normal; + previous_draw_normal = draw_normal; + } + + glVertex3fv(m_stroke[i].data()); + const EVec3f normal_end = m_stroke[i] + draw_normal * normal_length * (m_normal_side ? 1.0f : -1.0f); + glVertex3fv(normal_end.data()); + } + glEnd(); + } } @@ -633,7 +840,8 @@ void DeformationStrokes::Stroke::LoadState(const std::vector& _cps) { for (const auto& cp : _cps) m_cps.push_back(cp); - + + if (m_cps.size() >= 2) { m_plane_xyz = (fabsf(m_cps[0][0] - m_cps[1][0]) < 0.001f) ? 0 : @@ -642,7 +850,6 @@ void DeformationStrokes::Stroke::LoadState(const std::vector& _cps) } m_selected_cpid = (int) m_cps.size() - 1 ; UpdateStroke(); - } diff --git a/COMMON/DeformationStrokes.h b/COMMON/DeformationStrokes.h index 639034d..9340b74 100644 --- a/COMMON/DeformationStrokes.h +++ b/COMMON/DeformationStrokes.h @@ -35,8 +35,11 @@ class DeformationStrokes // Stroke Manipulation void AddNewStroke(); + void AddNewStroke(const Stroke &newstroke); void ClearAllStrokes(); int GetStrokePlaneXYZ(const int _idx); + bool GetStrokeNormalsSide(const int _idx); + void CleanStrokesNormalsSide(); void UnselectStroke(); int PickCPs(const EVec3f& ray_pos, const EVec3f& ray_dir, const float cp_radius, const bool change_selected_idx = true, const bool only_selected = false); @@ -45,6 +48,7 @@ class DeformationStrokes //Manipulation for selected stroke void Delete_SelStroke(); bool AddCP_SelStroke(const EVec3f& _pos); + bool AddCP_SelStroke(const EVec3f& _pos, const EVec3f& _nearest_vertex_normal); int GetPlaneXyz_SelStroke() const; float GetPlanePos_SelStroke() const; void Lock_SelStroke(); @@ -56,7 +60,7 @@ class DeformationStrokes void MoveSelectedCP(const EVec3f& _pos); void DeleteSelectedCP(); - void DrawStrokes(const bool& _only_selected_stroke = false) const; + void DrawStrokes(const bool& _only_selected_stroke = false, const bool& _show_nowrmals = true ) const; void DrawControlPoints(const float& _cp_radius, const bool& _only_selected_stroke = false) const; //Shared stroke関連 @@ -70,7 +74,11 @@ class DeformationStrokes void UnlockAllStrokes(); // copy from prevしたときの shared strokeの扱いが不明 bool bSelStrokeShared(); + + // flip normal + void FlipSelNormals(); + Stroke CloneSelStroke(); std::string OutputAsText() const; void LoadState(const std::vector& _vec_shared_idxs, const std::vector>& _vec_cps); @@ -88,6 +96,7 @@ class DeformationStrokes::Stroke //cp and stroke info std::vector m_stroke; std::vector m_cps; + bool m_normal_side; int m_selected_cpid; public: @@ -104,6 +113,7 @@ class DeformationStrokes::Stroke int GetNumCPs () const{ return static_cast(m_cps.size()); } int GetPlaneXYZ() const{ return m_plane_xyz; } float GetPlanePos() const{ return m_plane_pos; } + bool GetNormalSide() const { return m_normal_side; } void SetPlaneXYZ(int plane_xyz) { m_plane_xyz = plane_xyz; } void SetPlanePos(float plane_pos) { m_plane_pos = plane_pos; } std::vector GetStroke() const { return m_stroke; } @@ -120,13 +130,16 @@ class DeformationStrokes::Stroke //CP manipulation bool AddNewCP(const EVec3f _pos); + bool AddNewCP(const EVec3f _pos, const EVec3f& _nearest_vertex_normal); void MoveSelectedCP(const EVec3f& _pos); void DeleteSelectedCP(); int PickCPs(const EVec3f& _ray_pos, const EVec3f& _ray_dir, const float& _cp_radius, const bool& _change_selected_idx); + void FlipNormal(); + void ReverseStrokeAndCps(); void UpdateStroke(); - void DrawStroke(const bool& _is_selected) const; + void DrawStroke(const bool& _is_selected, const bool& _show_nowrmals) const; void DrawControlPoints(const float& _cp_radius, const bool& _is_selected) const; std::string OutputAsText() const; diff --git a/RoiPainter4D/RoiPainter4D/FormMain.cpp b/RoiPainter4D/RoiPainter4D/FormMain.cpp index 51d1187..5cb4150 100644 --- a/RoiPainter4D/RoiPainter4D/FormMain.cpp +++ b/RoiPainter4D/RoiPainter4D/FormMain.cpp @@ -19,6 +19,7 @@ #include "FormPlaceCPs.h" #include "FormRefCurveDeform.h" #include "FormSelectMskId.h" +#include "FormRefPixPaint.h" #pragma unmanaged #include "OglForCLI.h" @@ -39,6 +40,7 @@ #include "Mode/ModeSegStrokeFfd.h" #include "Mode/ModePlaceCPs.h" #include "Mode/ModeRefCurveDeform.h" +#include "Mode/ModeRefPixPaint.h" #include #include #pragma managed @@ -81,6 +83,7 @@ int main() ModeRefStrokeTrim::GetInst(); //ModeSegStrokeFfd::GetInst(); ModeRefCurveDeform::GetInst(); + ModeRefPixPaint::GetInst(); FormSegBolus::GetInst(); std::cout << "FormMain::getInst()->ShowDialog() \n"; @@ -147,6 +150,7 @@ void FormMain::InitializeSingletons() FormSegLocalRGrow::GetInst()->Show(); FormSegBolus::GetInst()->Show(); FormRefStrokeTrim::GetInst()->Show(); + FormRefPixPaint::GetInst()->Show(); FormSegSwallowOrgans::GetInst()->Show(); FormSegSwallowOrganTimeline::GetInst()->Show(); FormSegJointTracker::GetInst()->Show(); @@ -165,6 +169,7 @@ void FormMain::InitializeSingletons() FormSegLocalRGrow::GetInst()->Hide(); FormSegBolus::GetInst()->Hide(); FormRefStrokeTrim::GetInst()->Hide(); + FormRefPixPaint::GetInst()->Hide(); FormSegSwallowOrgans::GetInst()->Hide(); FormSegSwallowOrganTimeline::GetInst()->Hide(); FormSegJointTracker::GetInst()->Hide(); @@ -184,6 +189,7 @@ void FormMain::InitializeSingletons() FormSegLocalRGrow::GetInst()->Owner = this; FormSegBolus::GetInst()->Owner = this; FormRefStrokeTrim::GetInst()->Owner = this; + FormRefPixPaint::GetInst()->Owner = this; FormSegSwallowOrgans::GetInst()->Owner = this; FormSegStrokeFfd::GetInst()->Owner = this; FormSegSwallowOrganTimeline::GetInst()->Owner = this; @@ -403,6 +409,7 @@ void FormMain::ReplaceOtherForms() FormSegRigidICP ::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); FormSegLocalRGrow ::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); FormRefStrokeTrim ::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); + FormRefPixPaint ::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); FormSegBolus ::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); FormSegSwallowOrgans::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); FormSegJointTracker ::GetInst()->Location = Point(thisX + thisW, thisY + dlgH); @@ -482,6 +489,10 @@ System::Void FormMain::switch_refStrokeTrim_Click(System::Object^ sender, Syste ModeCore::GetInst()->ModeSwitch(MODE_REF_STRKTRIM); RedrawMainPanel(); } +System::Void FormMain::switch_refPixPaint_Click(System::Object^ sender, System::EventArgs^ e) { + ModeCore::GetInst()->ModeSwitch(MODE_REF_PIXPAINT); + RedrawMainPanel(); +} System::Void FormMain::switch_SegBolus_Click(System::Object^ sender, System::EventArgs^ e) { diff --git a/RoiPainter4D/RoiPainter4D/FormMain.h b/RoiPainter4D/RoiPainter4D/FormMain.h index 5104644..292451f 100644 --- a/RoiPainter4D/RoiPainter4D/FormMain.h +++ b/RoiPainter4D/RoiPainter4D/FormMain.h @@ -66,6 +66,9 @@ namespace RoiPainter4D { System::Windows::Forms::ToolStripSeparator^ toolStripSeparator6; private: System::Windows::Forms::ToolStripMenuItem^ exportMaskCentroidcsvToolStripMenuItem; private: System::Windows::Forms::ToolStripMenuItem^ exportMaskEigenvaluecsvToolStripMenuItem; + private: System::Windows::Forms::ToolStripMenuItem^ switch_refPixPaint; + + private: @@ -115,381 +118,394 @@ namespace RoiPainter4D { /// void InitializeComponent(void) { - this->FormMainPanel = (gcnew System::Windows::Forms::Panel()); - this->mainmenu = (gcnew System::Windows::Forms::MenuStrip()); - this->menu_file = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_dcm3d = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_dcm2D = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_traw3d = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_mha = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator()); - this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator()); - this->file_saveMask = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_saveMaskMha = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_saveMaskTrawub = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_loadMask = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_loadMaskMha = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_loadMaskTrawub = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator()); - this->file_export4dct_trawss = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->file_export4dct_mha = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->open3D8bitRawrawToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->exportMaskCentroidcsvToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->exportMaskEigenvaluecsvToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->modeSwitchToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_visNorm = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_visMask = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator()); - this->switch_segPaint = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_visRegionGrow = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segRigidICP = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segLocalRrow = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segBolus = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator()); - this->switch_refStrokeTrim = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator()); - this->switch_segStrokeFFD = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segBronchi = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segSwallowOrgans = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segSwallowTempGen = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segClosestPix = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_segJointTracker = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_placeCPs = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->switch_RefCurveDeform = (gcnew System::Windows::Forms::ToolStripMenuItem()); - this->m_progressbar = (gcnew System::Windows::Forms::ProgressBar()); - this->mainmenu->SuspendLayout(); - this->SuspendLayout(); - // - // FormMainPanel - // - this->FormMainPanel->Anchor = static_cast((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) - | System::Windows::Forms::AnchorStyles::Left) - | System::Windows::Forms::AnchorStyles::Right)); - this->FormMainPanel->Location = System::Drawing::Point(0, 27); - this->FormMainPanel->Name = L"FormMainPanel"; - this->FormMainPanel->Size = System::Drawing::Size(751, 675); - this->FormMainPanel->TabIndex = 0; - this->FormMainPanel->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &FormMain::FormMainPanel_Paint); - this->FormMainPanel->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_DblClick); - this->FormMainPanel->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseDown); - this->FormMainPanel->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseMove); - this->FormMainPanel->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseUp); - this->FormMainPanel->MouseWheel += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseWheel); - this->FormMainPanel->Resize += gcnew System::EventHandler(this, &FormMain::FormMainPanel_Resize); - // - // mainmenu - // - this->mainmenu->ImageScalingSize = System::Drawing::Size(24, 24); - this->mainmenu->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) { this->menu_file, this->modeSwitchToolStripMenuItem }); - this->mainmenu->Location = System::Drawing::Point(0, 0); - this->mainmenu->Name = L"mainmenu"; - this->mainmenu->Size = System::Drawing::Size(751, 24); - this->mainmenu->TabIndex = 1; - this->mainmenu->Text = L"menuStrip1"; - // - // menu_file - // - this->menu_file->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(18) { - this->file_dcm3d, - this->file_dcm2D, this->file_traw3d, this->file_mha, this->toolStripSeparator6, this->toolStripSeparator5, this->file_saveMask, - this->file_saveMaskMha, this->file_saveMaskTrawub, this->file_loadMask, this->file_loadMaskMha, this->file_loadMaskTrawub, this->toolStripSeparator4, - this->file_export4dct_trawss, this->file_export4dct_mha, this->open3D8bitRawrawToolStripMenuItem, this->exportMaskCentroidcsvToolStripMenuItem, - this->exportMaskEigenvaluecsvToolStripMenuItem - }); - this->menu_file->Name = L"menu_file"; - this->menu_file->Size = System::Drawing::Size(37, 20); - this->menu_file->Text = L"File"; - // - // file_dcm3d - // - this->file_dcm3d->Name = L"file_dcm3d"; - this->file_dcm3d->Size = System::Drawing::Size(230, 22); - this->file_dcm3d->Text = L"Open 4DCT (dcm 3D files)"; - this->file_dcm3d->Click += gcnew System::EventHandler(this, &FormMain::file_dcm3d_Click); - // - // file_dcm2D - // - this->file_dcm2D->Name = L"file_dcm2D"; - this->file_dcm2D->Size = System::Drawing::Size(230, 22); - this->file_dcm2D->Text = L"Open 4DCT (dcm 2D files)"; - this->file_dcm2D->Click += gcnew System::EventHandler(this, &FormMain::file_dcm2D_Click); - // - // file_traw3d - // - this->file_traw3d->Name = L"file_traw3d"; - this->file_traw3d->Size = System::Drawing::Size(230, 22); - this->file_traw3d->Text = L"Open 4DCT (traw3D files)"; - this->file_traw3d->Click += gcnew System::EventHandler(this, &FormMain::file_traw3d_Click); - // - // file_mha - // - this->file_mha->Name = L"file_mha"; - this->file_mha->Size = System::Drawing::Size(230, 22); - this->file_mha->Text = L"Open 4DCT (mha files)"; - this->file_mha->Click += gcnew System::EventHandler(this, &FormMain::file_mha_Click); - // - // toolStripSeparator6 - // - this->toolStripSeparator6->Name = L"toolStripSeparator6"; - this->toolStripSeparator6->Size = System::Drawing::Size(227, 6); - // - // toolStripSeparator5 - // - this->toolStripSeparator5->Name = L"toolStripSeparator5"; - this->toolStripSeparator5->Size = System::Drawing::Size(227, 6); - // - // file_saveMask - // - this->file_saveMask->Name = L"file_saveMask"; - this->file_saveMask->Size = System::Drawing::Size(230, 22); - this->file_saveMask->Text = L"Save Mask (.msk4)"; - this->file_saveMask->Click += gcnew System::EventHandler(this, &FormMain::file_saveMask_Click); - // - // file_saveMaskMha - // - this->file_saveMaskMha->Name = L"file_saveMaskMha"; - this->file_saveMaskMha->Size = System::Drawing::Size(230, 22); - this->file_saveMaskMha->Text = L"Save Mask (.mha)"; - this->file_saveMaskMha->Click += gcnew System::EventHandler(this, &FormMain::file_saveMaskMha_Click); - // - // file_saveMaskTrawub - // - this->file_saveMaskTrawub->Name = L"file_saveMaskTrawub"; - this->file_saveMaskTrawub->Size = System::Drawing::Size(230, 22); - this->file_saveMaskTrawub->Text = L"Save Mask (traw_ub)"; - this->file_saveMaskTrawub->Click += gcnew System::EventHandler(this, &FormMain::file_saveMasktrawub_Click); - // - // file_loadMask - // - this->file_loadMask->Name = L"file_loadMask"; - this->file_loadMask->Size = System::Drawing::Size(230, 22); - this->file_loadMask->Text = L"Load Mask (.msk4)"; - this->file_loadMask->Click += gcnew System::EventHandler(this, &FormMain::file_loadMask_Click); - // - // file_loadMaskMha - // - this->file_loadMaskMha->Name = L"file_loadMaskMha"; - this->file_loadMaskMha->Size = System::Drawing::Size(230, 22); - this->file_loadMaskMha->Text = L"Load Mask (.mha)"; - this->file_loadMaskMha->Click += gcnew System::EventHandler(this, &FormMain::file_loadMaskMha_Click); - // - // file_loadMaskTrawub - // - this->file_loadMaskTrawub->Name = L"file_loadMaskTrawub"; - this->file_loadMaskTrawub->Size = System::Drawing::Size(230, 22); - this->file_loadMaskTrawub->Text = L"Load Mask (traw_ub)"; - this->file_loadMaskTrawub->Click += gcnew System::EventHandler(this, &FormMain::file_loadMasktrawub_Click); - // - // toolStripSeparator4 - // - this->toolStripSeparator4->Name = L"toolStripSeparator4"; - this->toolStripSeparator4->Size = System::Drawing::Size(227, 6); - // - // file_export4dct_trawss - // - this->file_export4dct_trawss->Name = L"file_export4dct_trawss"; - this->file_export4dct_trawss->Size = System::Drawing::Size(230, 22); - this->file_export4dct_trawss->Text = L"Export 4DCT (.traw_ss)"; - this->file_export4dct_trawss->Click += gcnew System::EventHandler(this, &FormMain::file_export4dcttraw_Click); - // - // file_export4dct_mha - // - this->file_export4dct_mha->Name = L"file_export4dct_mha"; - this->file_export4dct_mha->Size = System::Drawing::Size(230, 22); - this->file_export4dct_mha->Text = L"Export 4DCT (.mha)"; - this->file_export4dct_mha->Click += gcnew System::EventHandler(this, &FormMain::file_export4dct_mha_Click); - // - // open3D8bitRawrawToolStripMenuItem - // - this->open3D8bitRawrawToolStripMenuItem->Name = L"open3D8bitRawrawToolStripMenuItem"; - this->open3D8bitRawrawToolStripMenuItem->Size = System::Drawing::Size(230, 22); - this->open3D8bitRawrawToolStripMenuItem->Text = L"Open 3D 8bit raw (.raw)"; - this->open3D8bitRawrawToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormMain::file_raw8bit_Click); - // - // exportMaskCentroidcsvToolStripMenuItem - // - this->exportMaskCentroidcsvToolStripMenuItem->Name = L"exportMaskCentroidcsvToolStripMenuItem"; - this->exportMaskCentroidcsvToolStripMenuItem->Size = System::Drawing::Size(230, 22); - this->exportMaskCentroidcsvToolStripMenuItem->Text = L"Export Mask Centroid (.csv)"; - this->exportMaskCentroidcsvToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormMain::exportMaskCentroidcsvToolStripMenuItem_Click); - // - // exportMaskEigenvaluecsvToolStripMenuItem - // - this->exportMaskEigenvaluecsvToolStripMenuItem->Name = L"exportMaskEigenvaluecsvToolStripMenuItem"; - this->exportMaskEigenvaluecsvToolStripMenuItem->Size = System::Drawing::Size(230, 22); - this->exportMaskEigenvaluecsvToolStripMenuItem->Text = L"Export Mask Eigenvalue (.csv)"; - this->exportMaskEigenvaluecsvToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormMain::exportMaskEigenvaluecsvToolStripMenuItem_Click); - // - // modeSwitchToolStripMenuItem - // - this->modeSwitchToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(19) { - this->switch_visNorm, - this->switch_visMask, this->toolStripSeparator1, this->switch_segPaint, this->switch_visRegionGrow, this->switch_segRigidICP, - this->switch_segLocalRrow, this->switch_segBolus, this->switch_segSwallowOrgans, this->switch_segStrokeFFD, this->toolStripSeparator2, - this->switch_refStrokeTrim, this->switch_RefCurveDeform, this->toolStripSeparator3, this->switch_placeCPs, this->switch_segBronchi, - this->switch_segSwallowTempGen, this->switch_segClosestPix, this->switch_segJointTracker - }); - this->modeSwitchToolStripMenuItem->Name = L"modeSwitchToolStripMenuItem"; - this->modeSwitchToolStripMenuItem->Size = System::Drawing::Size(86, 20); - this->modeSwitchToolStripMenuItem->Text = L"mode switch"; - // - // switch_visNorm - // - this->switch_visNorm->Name = L"switch_visNorm"; - this->switch_visNorm->Size = System::Drawing::Size(304, 22); - this->switch_visNorm->Text = L"Vis Normal"; - this->switch_visNorm->Click += gcnew System::EventHandler(this, &FormMain::switch_visNorm_Click); - // - // switch_visMask - // - this->switch_visMask->Name = L"switch_visMask"; - this->switch_visMask->Size = System::Drawing::Size(304, 22); - this->switch_visMask->Text = L"Vis Mask"; - this->switch_visMask->Click += gcnew System::EventHandler(this, &FormMain::switch_visMask_Click); - // - // toolStripSeparator1 - // - this->toolStripSeparator1->Name = L"toolStripSeparator1"; - this->toolStripSeparator1->Size = System::Drawing::Size(301, 6); - // - // switch_segPaint - // - this->switch_segPaint->Name = L"switch_segPaint"; - this->switch_segPaint->Size = System::Drawing::Size(304, 22); - this->switch_segPaint->Text = L"Seg Paint and Lasso"; - this->switch_segPaint->Click += gcnew System::EventHandler(this, &FormMain::switch_segPaint_Click); - // - // switch_visRegionGrow - // - this->switch_visRegionGrow->Name = L"switch_visRegionGrow"; - this->switch_visRegionGrow->Size = System::Drawing::Size(304, 22); - this->switch_visRegionGrow->Text = L"Seg Threshold and Region grow"; - this->switch_visRegionGrow->Click += gcnew System::EventHandler(this, &FormMain::switch_visRegionGrow_Click); - // - // switch_segRigidICP - // - this->switch_segRigidICP->Name = L"switch_segRigidICP"; - this->switch_segRigidICP->Size = System::Drawing::Size(304, 22); - this->switch_segRigidICP->Text = L"Seg Rigid Tracking (ICP)"; - this->switch_segRigidICP->Click += gcnew System::EventHandler(this, &FormMain::switch_segRigidICP_Click); - // - // switch_segLocalRrow - // - this->switch_segLocalRrow->Name = L"switch_segLocalRrow"; - this->switch_segLocalRrow->Size = System::Drawing::Size(304, 22); - this->switch_segLocalRrow->Text = L"Seg Local Region Growing (Sphere)"; - this->switch_segLocalRrow->Click += gcnew System::EventHandler(this, &FormMain::switch_segLocalRrow_Click); - // - // switch_segBolus - // - this->switch_segBolus->Name = L"switch_segBolus"; - this->switch_segBolus->Size = System::Drawing::Size(304, 22); - this->switch_segBolus->Text = L"Seg Local Region Growing (curved cylinder)"; - this->switch_segBolus->Click += gcnew System::EventHandler(this, &FormMain::switch_SegBolus_Click); - // - // toolStripSeparator2 - // - this->toolStripSeparator2->Name = L"toolStripSeparator2"; - this->toolStripSeparator2->Size = System::Drawing::Size(301, 6); - // - // switch_refStrokeTrim - // - this->switch_refStrokeTrim->Name = L"switch_refStrokeTrim"; - this->switch_refStrokeTrim->Size = System::Drawing::Size(304, 22); - this->switch_refStrokeTrim->Text = L"Ref Stroke Trim"; - this->switch_refStrokeTrim->Click += gcnew System::EventHandler(this, &FormMain::switch_refStrokeTrim_Click); - // - // toolStripSeparator3 - // - this->toolStripSeparator3->Name = L"toolStripSeparator3"; - this->toolStripSeparator3->Size = System::Drawing::Size(301, 6); - // - // switch_segStrokeFFD - // - this->switch_segStrokeFFD->Name = L"switch_segStrokeFFD"; - this->switch_segStrokeFFD->Size = System::Drawing::Size(304, 22); - this->switch_segStrokeFFD->Text = L"Seg Swallow Organs (Stroke FFD)"; - this->switch_segStrokeFFD->Click += gcnew System::EventHandler(this, &FormMain::switch_segStrokeFFD_Click); - // - // switch_segBronchi - // - this->switch_segBronchi->Name = L"switch_segBronchi"; - this->switch_segBronchi->Size = System::Drawing::Size(304, 22); - this->switch_segBronchi->Text = L"Seg Bronchi"; - this->switch_segBronchi->Click += gcnew System::EventHandler(this, &FormMain::switch_segBronchi_Click); - // - // switch_segSwallowOrgans - // - this->switch_segSwallowOrgans->Name = L"switch_segSwallowOrgans"; - this->switch_segSwallowOrgans->Size = System::Drawing::Size(304, 22); - this->switch_segSwallowOrgans->Text = L"Seg Swallow Organs (FFD)"; - this->switch_segSwallowOrgans->Click += gcnew System::EventHandler(this, &FormMain::switch_segSwallowOrgans_Click); - // - // switch_segSwallowTempGen - // - this->switch_segSwallowTempGen->Name = L"switch_segSwallowTempGen"; - this->switch_segSwallowTempGen->Size = System::Drawing::Size(304, 22); - this->switch_segSwallowTempGen->Text = L"Seg Swallow Template Gen"; - this->switch_segSwallowTempGen->Click += gcnew System::EventHandler(this, &FormMain::switch_segSwallowTempGen_Click); - // - // switch_segClosestPix - // - this->switch_segClosestPix->Enabled = false; - this->switch_segClosestPix->Name = L"switch_segClosestPix"; - this->switch_segClosestPix->Size = System::Drawing::Size(304, 22); - this->switch_segClosestPix->Text = L"Seg Closest Pixel (Sprout Project)"; - this->switch_segClosestPix->Click += gcnew System::EventHandler(this, &FormMain::switch_segClosestPix_Click); - // - // switch_segJointTracker - // - this->switch_segJointTracker->Enabled = false; - this->switch_segJointTracker->Name = L"switch_segJointTracker"; - this->switch_segJointTracker->Size = System::Drawing::Size(304, 22); - this->switch_segJointTracker->Text = L"Seg Joint Tracker"; - this->switch_segJointTracker->Click += gcnew System::EventHandler(this, &FormMain::switch_segJointTracker_Click); - // - // switch_placeCPs - // - this->switch_placeCPs->Name = L"switch_placeCPs"; - this->switch_placeCPs->Size = System::Drawing::Size(304, 22); - this->switch_placeCPs->Text = L"Place Points"; - this->switch_placeCPs->Click += gcnew System::EventHandler(this, &FormMain::switch_placeCPs_Click); - // - // switch_RefCurveDeform - // - this->switch_RefCurveDeform->Name = L"switch_RefCurveDeform"; - this->switch_RefCurveDeform->Size = System::Drawing::Size(304, 22); - this->switch_RefCurveDeform->Text = L"Ref Curve Deform"; - this->switch_RefCurveDeform->Click += gcnew System::EventHandler(this, &FormMain::switch_RefCurveDeform_Click); - // - // m_progressbar - // - this->m_progressbar->Location = System::Drawing::Point(632, 0); - this->m_progressbar->Name = L"m_progressbar"; - this->m_progressbar->Size = System::Drawing::Size(118, 23); - this->m_progressbar->TabIndex = 2; - // - // FormMain - // - this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); - this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; - this->ClientSize = System::Drawing::Size(751, 702); - this->Controls->Add(this->m_progressbar); - this->Controls->Add(this->FormMainPanel); - this->Controls->Add(this->mainmenu); - this->MainMenuStrip = this->mainmenu; - this->Name = L"FormMain"; - this->Text = L"FormMain"; - this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &FormMain::FormMain_KeyDown); - this->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &FormMain::FormMain_KeyPress); - this->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &FormMain::FormMain_KeyUp); - this->MouseWheel += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMain_MouseWheel); - this->Move += gcnew System::EventHandler(this, &FormMain::FormMain_Move); - this->Resize += gcnew System::EventHandler(this, &FormMain::FormMain_Resize); - this->mainmenu->ResumeLayout(false); - this->mainmenu->PerformLayout(); - this->ResumeLayout(false); - this->PerformLayout(); + this->FormMainPanel = (gcnew System::Windows::Forms::Panel()); + this->mainmenu = (gcnew System::Windows::Forms::MenuStrip()); + this->menu_file = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_dcm3d = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_dcm2D = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_traw3d = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_mha = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->file_saveMask = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_saveMaskMha = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_saveMaskTrawub = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_loadMask = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_loadMaskMha = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_loadMaskTrawub = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->file_export4dct_trawss = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->file_export4dct_mha = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->open3D8bitRawrawToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->exportMaskCentroidcsvToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->exportMaskEigenvaluecsvToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->modeSwitchToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_visNorm = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_visMask = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->switch_segPaint = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_visRegionGrow = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segRigidICP = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segLocalRrow = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segBolus = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segSwallowOrgans = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segStrokeFFD = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->switch_refStrokeTrim = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_RefCurveDeform = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_refPixPaint = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator()); + this->switch_placeCPs = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segBronchi = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segSwallowTempGen = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segClosestPix = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->switch_segJointTracker = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->m_progressbar = (gcnew System::Windows::Forms::ProgressBar()); + this->mainmenu->SuspendLayout(); + this->SuspendLayout(); + // + // FormMainPanel + // + this->FormMainPanel->Anchor = static_cast((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) + | System::Windows::Forms::AnchorStyles::Left) + | System::Windows::Forms::AnchorStyles::Right)); + this->FormMainPanel->Location = System::Drawing::Point(0, 40); + this->FormMainPanel->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->FormMainPanel->Name = L"FormMainPanel"; + this->FormMainPanel->Size = System::Drawing::Size(1252, 1012); + this->FormMainPanel->TabIndex = 0; + this->FormMainPanel->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &FormMain::FormMainPanel_Paint); + this->FormMainPanel->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_DblClick); + this->FormMainPanel->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseDown); + this->FormMainPanel->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseMove); + this->FormMainPanel->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseUp); + this->FormMainPanel->MouseWheel += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMainPanel_MouseWheel); + this->FormMainPanel->Resize += gcnew System::EventHandler(this, &FormMain::FormMainPanel_Resize); + // + // mainmenu + // + this->mainmenu->GripMargin = System::Windows::Forms::Padding(2, 2, 0, 2); + this->mainmenu->ImageScalingSize = System::Drawing::Size(24, 24); + this->mainmenu->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) { this->menu_file, this->modeSwitchToolStripMenuItem }); + this->mainmenu->Location = System::Drawing::Point(0, 0); + this->mainmenu->Name = L"mainmenu"; + this->mainmenu->Padding = System::Windows::Forms::Padding(10, 3, 0, 3); + this->mainmenu->Size = System::Drawing::Size(1252, 35); + this->mainmenu->TabIndex = 1; + this->mainmenu->Text = L"menuStrip1"; + // + // menu_file + // + this->menu_file->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(18) { + this->file_dcm3d, + this->file_dcm2D, this->file_traw3d, this->file_mha, this->toolStripSeparator6, this->toolStripSeparator5, this->file_saveMask, + this->file_saveMaskMha, this->file_saveMaskTrawub, this->file_loadMask, this->file_loadMaskMha, this->file_loadMaskTrawub, this->toolStripSeparator4, + this->file_export4dct_trawss, this->file_export4dct_mha, this->open3D8bitRawrawToolStripMenuItem, this->exportMaskCentroidcsvToolStripMenuItem, + this->exportMaskEigenvaluecsvToolStripMenuItem + }); + this->menu_file->Name = L"menu_file"; + this->menu_file->Size = System::Drawing::Size(54, 29); + this->menu_file->Text = L"File"; + // + // file_dcm3d + // + this->file_dcm3d->Name = L"file_dcm3d"; + this->file_dcm3d->Size = System::Drawing::Size(345, 34); + this->file_dcm3d->Text = L"Open 4DCT (dcm 3D files)"; + this->file_dcm3d->Click += gcnew System::EventHandler(this, &FormMain::file_dcm3d_Click); + // + // file_dcm2D + // + this->file_dcm2D->Name = L"file_dcm2D"; + this->file_dcm2D->Size = System::Drawing::Size(345, 34); + this->file_dcm2D->Text = L"Open 4DCT (dcm 2D files)"; + this->file_dcm2D->Click += gcnew System::EventHandler(this, &FormMain::file_dcm2D_Click); + // + // file_traw3d + // + this->file_traw3d->Name = L"file_traw3d"; + this->file_traw3d->Size = System::Drawing::Size(345, 34); + this->file_traw3d->Text = L"Open 4DCT (traw3D files)"; + this->file_traw3d->Click += gcnew System::EventHandler(this, &FormMain::file_traw3d_Click); + // + // file_mha + // + this->file_mha->Name = L"file_mha"; + this->file_mha->Size = System::Drawing::Size(345, 34); + this->file_mha->Text = L"Open 4DCT (mha files)"; + this->file_mha->Click += gcnew System::EventHandler(this, &FormMain::file_mha_Click); + // + // toolStripSeparator6 + // + this->toolStripSeparator6->Name = L"toolStripSeparator6"; + this->toolStripSeparator6->Size = System::Drawing::Size(342, 6); + // + // toolStripSeparator5 + // + this->toolStripSeparator5->Name = L"toolStripSeparator5"; + this->toolStripSeparator5->Size = System::Drawing::Size(342, 6); + // + // file_saveMask + // + this->file_saveMask->Name = L"file_saveMask"; + this->file_saveMask->Size = System::Drawing::Size(345, 34); + this->file_saveMask->Text = L"Save Mask (.msk4)"; + this->file_saveMask->Click += gcnew System::EventHandler(this, &FormMain::file_saveMask_Click); + // + // file_saveMaskMha + // + this->file_saveMaskMha->Name = L"file_saveMaskMha"; + this->file_saveMaskMha->Size = System::Drawing::Size(345, 34); + this->file_saveMaskMha->Text = L"Save Mask (.mha)"; + this->file_saveMaskMha->Click += gcnew System::EventHandler(this, &FormMain::file_saveMaskMha_Click); + // + // file_saveMaskTrawub + // + this->file_saveMaskTrawub->Name = L"file_saveMaskTrawub"; + this->file_saveMaskTrawub->Size = System::Drawing::Size(345, 34); + this->file_saveMaskTrawub->Text = L"Save Mask (traw_ub)"; + this->file_saveMaskTrawub->Click += gcnew System::EventHandler(this, &FormMain::file_saveMasktrawub_Click); + // + // file_loadMask + // + this->file_loadMask->Name = L"file_loadMask"; + this->file_loadMask->Size = System::Drawing::Size(345, 34); + this->file_loadMask->Text = L"Load Mask (.msk4)"; + this->file_loadMask->Click += gcnew System::EventHandler(this, &FormMain::file_loadMask_Click); + // + // file_loadMaskMha + // + this->file_loadMaskMha->Name = L"file_loadMaskMha"; + this->file_loadMaskMha->Size = System::Drawing::Size(345, 34); + this->file_loadMaskMha->Text = L"Load Mask (.mha)"; + this->file_loadMaskMha->Click += gcnew System::EventHandler(this, &FormMain::file_loadMaskMha_Click); + // + // file_loadMaskTrawub + // + this->file_loadMaskTrawub->Name = L"file_loadMaskTrawub"; + this->file_loadMaskTrawub->Size = System::Drawing::Size(345, 34); + this->file_loadMaskTrawub->Text = L"Load Mask (traw_ub)"; + this->file_loadMaskTrawub->Click += gcnew System::EventHandler(this, &FormMain::file_loadMasktrawub_Click); + // + // toolStripSeparator4 + // + this->toolStripSeparator4->Name = L"toolStripSeparator4"; + this->toolStripSeparator4->Size = System::Drawing::Size(342, 6); + // + // file_export4dct_trawss + // + this->file_export4dct_trawss->Name = L"file_export4dct_trawss"; + this->file_export4dct_trawss->Size = System::Drawing::Size(345, 34); + this->file_export4dct_trawss->Text = L"Export 4DCT (.traw_ss)"; + this->file_export4dct_trawss->Click += gcnew System::EventHandler(this, &FormMain::file_export4dcttraw_Click); + // + // file_export4dct_mha + // + this->file_export4dct_mha->Name = L"file_export4dct_mha"; + this->file_export4dct_mha->Size = System::Drawing::Size(345, 34); + this->file_export4dct_mha->Text = L"Export 4DCT (.mha)"; + this->file_export4dct_mha->Click += gcnew System::EventHandler(this, &FormMain::file_export4dct_mha_Click); + // + // open3D8bitRawrawToolStripMenuItem + // + this->open3D8bitRawrawToolStripMenuItem->Name = L"open3D8bitRawrawToolStripMenuItem"; + this->open3D8bitRawrawToolStripMenuItem->Size = System::Drawing::Size(345, 34); + this->open3D8bitRawrawToolStripMenuItem->Text = L"Open 3D 8bit raw (.raw)"; + this->open3D8bitRawrawToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormMain::file_raw8bit_Click); + // + // exportMaskCentroidcsvToolStripMenuItem + // + this->exportMaskCentroidcsvToolStripMenuItem->Name = L"exportMaskCentroidcsvToolStripMenuItem"; + this->exportMaskCentroidcsvToolStripMenuItem->Size = System::Drawing::Size(345, 34); + this->exportMaskCentroidcsvToolStripMenuItem->Text = L"Export Mask Centroid (.csv)"; + this->exportMaskCentroidcsvToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormMain::exportMaskCentroidcsvToolStripMenuItem_Click); + // + // exportMaskEigenvaluecsvToolStripMenuItem + // + this->exportMaskEigenvaluecsvToolStripMenuItem->Name = L"exportMaskEigenvaluecsvToolStripMenuItem"; + this->exportMaskEigenvaluecsvToolStripMenuItem->Size = System::Drawing::Size(345, 34); + this->exportMaskEigenvaluecsvToolStripMenuItem->Text = L"Export Mask Eigenvalue (.csv)"; + this->exportMaskEigenvaluecsvToolStripMenuItem->Click += gcnew System::EventHandler(this, &FormMain::exportMaskEigenvaluecsvToolStripMenuItem_Click); + // + // modeSwitchToolStripMenuItem + // + this->modeSwitchToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(20) { + this->switch_visNorm, + this->switch_visMask, this->toolStripSeparator1, this->switch_segPaint, this->switch_visRegionGrow, this->switch_segRigidICP, + this->switch_segLocalRrow, this->switch_segBolus, this->switch_segSwallowOrgans, this->switch_segStrokeFFD, this->toolStripSeparator2, + this->switch_refStrokeTrim, this->switch_RefCurveDeform, this->switch_refPixPaint, this->toolStripSeparator3, this->switch_placeCPs, + this->switch_segBronchi, this->switch_segSwallowTempGen, this->switch_segClosestPix, this->switch_segJointTracker + }); + this->modeSwitchToolStripMenuItem->Name = L"modeSwitchToolStripMenuItem"; + this->modeSwitchToolStripMenuItem->Size = System::Drawing::Size(129, 29); + this->modeSwitchToolStripMenuItem->Text = L"mode switch"; + // + // switch_visNorm + // + this->switch_visNorm->Name = L"switch_visNorm"; + this->switch_visNorm->Size = System::Drawing::Size(456, 34); + this->switch_visNorm->Text = L"Vis Normal"; + this->switch_visNorm->Click += gcnew System::EventHandler(this, &FormMain::switch_visNorm_Click); + // + // switch_visMask + // + this->switch_visMask->Name = L"switch_visMask"; + this->switch_visMask->Size = System::Drawing::Size(456, 34); + this->switch_visMask->Text = L"Vis Mask"; + this->switch_visMask->Click += gcnew System::EventHandler(this, &FormMain::switch_visMask_Click); + // + // toolStripSeparator1 + // + this->toolStripSeparator1->Name = L"toolStripSeparator1"; + this->toolStripSeparator1->Size = System::Drawing::Size(453, 6); + // + // switch_segPaint + // + this->switch_segPaint->Name = L"switch_segPaint"; + this->switch_segPaint->Size = System::Drawing::Size(456, 34); + this->switch_segPaint->Text = L"Seg Paint and Lasso"; + this->switch_segPaint->Click += gcnew System::EventHandler(this, &FormMain::switch_segPaint_Click); + // + // switch_visRegionGrow + // + this->switch_visRegionGrow->Name = L"switch_visRegionGrow"; + this->switch_visRegionGrow->Size = System::Drawing::Size(456, 34); + this->switch_visRegionGrow->Text = L"Seg Threshold and Region grow"; + this->switch_visRegionGrow->Click += gcnew System::EventHandler(this, &FormMain::switch_visRegionGrow_Click); + // + // switch_segRigidICP + // + this->switch_segRigidICP->Name = L"switch_segRigidICP"; + this->switch_segRigidICP->Size = System::Drawing::Size(456, 34); + this->switch_segRigidICP->Text = L"Seg Rigid Tracking (ICP)"; + this->switch_segRigidICP->Click += gcnew System::EventHandler(this, &FormMain::switch_segRigidICP_Click); + // + // switch_segLocalRrow + // + this->switch_segLocalRrow->Name = L"switch_segLocalRrow"; + this->switch_segLocalRrow->Size = System::Drawing::Size(456, 34); + this->switch_segLocalRrow->Text = L"Seg Local Region Growing (Sphere)"; + this->switch_segLocalRrow->Click += gcnew System::EventHandler(this, &FormMain::switch_segLocalRrow_Click); + // + // switch_segBolus + // + this->switch_segBolus->Name = L"switch_segBolus"; + this->switch_segBolus->Size = System::Drawing::Size(456, 34); + this->switch_segBolus->Text = L"Seg Local Region Growing (curved cylinder)"; + this->switch_segBolus->Click += gcnew System::EventHandler(this, &FormMain::switch_SegBolus_Click); + // + // switch_segSwallowOrgans + // + this->switch_segSwallowOrgans->Name = L"switch_segSwallowOrgans"; + this->switch_segSwallowOrgans->Size = System::Drawing::Size(456, 34); + this->switch_segSwallowOrgans->Text = L"Seg Swallow Organs (FFD)"; + this->switch_segSwallowOrgans->Click += gcnew System::EventHandler(this, &FormMain::switch_segSwallowOrgans_Click); + // + // switch_segStrokeFFD + // + this->switch_segStrokeFFD->Name = L"switch_segStrokeFFD"; + this->switch_segStrokeFFD->Size = System::Drawing::Size(456, 34); + this->switch_segStrokeFFD->Text = L"Seg Swallow Organs (Stroke FFD)"; + this->switch_segStrokeFFD->Click += gcnew System::EventHandler(this, &FormMain::switch_segStrokeFFD_Click); + // + // toolStripSeparator2 + // + this->toolStripSeparator2->Name = L"toolStripSeparator2"; + this->toolStripSeparator2->Size = System::Drawing::Size(453, 6); + // + // switch_refStrokeTrim + // + this->switch_refStrokeTrim->Name = L"switch_refStrokeTrim"; + this->switch_refStrokeTrim->Size = System::Drawing::Size(456, 34); + this->switch_refStrokeTrim->Text = L"Ref Stroke Trim"; + this->switch_refStrokeTrim->Click += gcnew System::EventHandler(this, &FormMain::switch_refStrokeTrim_Click); + // + // switch_RefCurveDeform + // + this->switch_RefCurveDeform->Name = L"switch_RefCurveDeform"; + this->switch_RefCurveDeform->Size = System::Drawing::Size(456, 34); + this->switch_RefCurveDeform->Text = L"Ref Curve Deform"; + this->switch_RefCurveDeform->Click += gcnew System::EventHandler(this, &FormMain::switch_RefCurveDeform_Click); + // + // switch_refPixPaint + // + this->switch_refPixPaint->Name = L"switch_refPixPaint"; + this->switch_refPixPaint->Size = System::Drawing::Size(456, 34); + this->switch_refPixPaint->Text = L"Ref Paint lasso and Region grow"; + this->switch_refPixPaint->Click += gcnew System::EventHandler(this, &FormMain::switch_refPixPaint_Click); + // + // toolStripSeparator3 + // + this->toolStripSeparator3->Name = L"toolStripSeparator3"; + this->toolStripSeparator3->Size = System::Drawing::Size(453, 6); + // + // switch_placeCPs + // + this->switch_placeCPs->Name = L"switch_placeCPs"; + this->switch_placeCPs->Size = System::Drawing::Size(456, 34); + this->switch_placeCPs->Text = L"Place Points"; + this->switch_placeCPs->Click += gcnew System::EventHandler(this, &FormMain::switch_placeCPs_Click); + // + // switch_segBronchi + // + this->switch_segBronchi->Name = L"switch_segBronchi"; + this->switch_segBronchi->Size = System::Drawing::Size(456, 34); + this->switch_segBronchi->Text = L"Seg Bronchi"; + this->switch_segBronchi->Click += gcnew System::EventHandler(this, &FormMain::switch_segBronchi_Click); + // + // switch_segSwallowTempGen + // + this->switch_segSwallowTempGen->Name = L"switch_segSwallowTempGen"; + this->switch_segSwallowTempGen->Size = System::Drawing::Size(456, 34); + this->switch_segSwallowTempGen->Text = L"Seg Swallow Template Gen"; + this->switch_segSwallowTempGen->Click += gcnew System::EventHandler(this, &FormMain::switch_segSwallowTempGen_Click); + // + // switch_segClosestPix + // + this->switch_segClosestPix->Enabled = false; + this->switch_segClosestPix->Name = L"switch_segClosestPix"; + this->switch_segClosestPix->Size = System::Drawing::Size(456, 34); + this->switch_segClosestPix->Text = L"Seg Closest Pixel (Sprout Project)"; + this->switch_segClosestPix->Click += gcnew System::EventHandler(this, &FormMain::switch_segClosestPix_Click); + // + // switch_segJointTracker + // + this->switch_segJointTracker->Enabled = false; + this->switch_segJointTracker->Name = L"switch_segJointTracker"; + this->switch_segJointTracker->Size = System::Drawing::Size(456, 34); + this->switch_segJointTracker->Text = L"Seg Joint Tracker"; + this->switch_segJointTracker->Click += gcnew System::EventHandler(this, &FormMain::switch_segJointTracker_Click); + // + // m_progressbar + // + this->m_progressbar->Location = System::Drawing::Point(1053, 0); + this->m_progressbar->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->m_progressbar->Name = L"m_progressbar"; + this->m_progressbar->Size = System::Drawing::Size(197, 34); + this->m_progressbar->TabIndex = 2; + // + // FormMain + // + this->AutoScaleDimensions = System::Drawing::SizeF(10, 18); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->ClientSize = System::Drawing::Size(1252, 1053); + this->Controls->Add(this->m_progressbar); + this->Controls->Add(this->FormMainPanel); + this->Controls->Add(this->mainmenu); + this->MainMenuStrip = this->mainmenu; + this->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->Name = L"FormMain"; + this->Text = L"FormMain"; + this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &FormMain::FormMain_KeyDown); + this->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &FormMain::FormMain_KeyPress); + this->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &FormMain::FormMain_KeyUp); + this->MouseWheel += gcnew System::Windows::Forms::MouseEventHandler(this, &FormMain::FormMain_MouseWheel); + this->Move += gcnew System::EventHandler(this, &FormMain::FormMain_Move); + this->Resize += gcnew System::EventHandler(this, &FormMain::FormMain_Resize); + this->mainmenu->ResumeLayout(false); + this->mainmenu->PerformLayout(); + this->ResumeLayout(false); + this->PerformLayout(); } @@ -546,6 +562,7 @@ namespace RoiPainter4D { //edit shionozaki System::Void switch_SegBolus_Click(System::Object^ sender, System::EventArgs^ e) ; System::Void switch_refStrokeTrim_Click(System::Object^ sender, System::EventArgs^ e); + System::Void switch_refPixPaint_Click(System::Object^ sender, System::EventArgs^ e); System::Void FormMain_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e); System::Void FormMain_KeyUp(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e); System::Void FormMain_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e); diff --git a/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.cpp b/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.cpp index 907c67c..16e2905 100644 --- a/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.cpp +++ b/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.cpp @@ -2,10 +2,11 @@ #include "FormRefCurveDeform.h" #include "FormMain.h" #include "FormSelectMskId.h" -//#include "CliMessageBox.h" +#include "CliMessageBox.h" #pragma unmanaged #include "ImageCore.h" +#include "ModeCore.h" #include "mode/ModeRefCurveDeform.h" #pragma managed @@ -15,14 +16,22 @@ using namespace RoiPainter4D; void FormRefCurveDeform::InitAllItems() { - m_numbox_cpsize->Value = 10; - m_checkbox_showonlyselectedstroke->Checked = true; + m_numbox_cpsize->Value = 3; + m_checkbox_showonlyselectedstroke->Checked = false; m_trackbar_mcscale->Value = 2; + m_checkbox_vissurf_trans->Checked = true; + m_checkbox_vissurf_solid->Checked = false; FormSelectMskId^ modal = gcnew FormSelectMskId(); if (modal->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) return; int trgtId = modal->getTrgtID(); + if (trgtId == 0) + { + ShowMsgDlg_OK("0th region (background) cannot be deformed", "caution"); + ModeCore::GetInst()->ModeSwitch(MODE_VIS_NORMAL); + return; + } modal->Close(); ImageCore::GetInst()->SetSelectMaskId(trgtId); @@ -64,6 +73,10 @@ System::Void FormRefCurveDeform::m_copy_from_prev_frame_Click(System::Object^ se ModeRefCurveDeform::GetInst()->CopyFromPrevFrame(); } +System::Void FormRefCurveDeform::m_copy_to_next_frame_Click(System::Object^ sender, System::EventArgs^ e) +{ + ModeRefCurveDeform::GetInst()->CopyToNextFrame(); +} System::Void FormRefCurveDeform::m_btn_convert_mesh_mask_Click(System::Object^ sender, System::EventArgs^ e) { @@ -99,6 +112,42 @@ System::Void FormRefCurveDeform::m_btn_savestate_Click(System::Object^ sender, S SaveState(); } +System::Void FormRefCurveDeform::m_btn_flip_normals_Click(System::Object^ sender, System::EventArgs^ e) +{ + ModeRefCurveDeform::GetInst()->FlipSelectedStrokeNormalSide(); +} + +System::Void FormRefCurveDeform::m_checkbox_visbound_CheckedChanged( + System::Object^ sender, + System::EventArgs^ e) +{ + formMain_RedrawMainPanel(); +} + +System::Void FormRefCurveDeform::m_checkbox_vissurf_CheckedChanged( + System::Object^ sender, + System::EventArgs^ e) +{ + if (m_checkbox_vissurf_trans->Checked) + m_checkbox_vissurf_solid->Checked = false; + formMain_RedrawMainPanel(); +} + +System::Void FormRefCurveDeform::m_checkbox_vissurf_solid_CheckedChanged( + System::Object^ sender, + System::EventArgs^ e) +{ + if (m_checkbox_vissurf_solid->Checked) + m_checkbox_vissurf_trans->Checked = false; + formMain_RedrawMainPanel(); +} + +System::Void FormRefCurveDeform::m_checkbox_visnormals_CheckedChanged( + System::Object^ sender, + System::EventArgs^ e) +{ + formMain_RedrawMainPanel(); +} void FormRefCurveDeform::LoadState() { diff --git a/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.h b/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.h index ed5ef0c..093840a 100644 --- a/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.h +++ b/RoiPainter4D/RoiPainter4D/FormRefCurveDeform.h @@ -71,6 +71,15 @@ namespace RoiPainter4D { private: System::Windows::Forms::Button^ m_btn_loadstate; private: System::Windows::Forms::Button^ m_btn_savestate; + private: System::Windows::Forms::Label^ label6; + private: System::Windows::Forms::Label^ label7; + private: System::Windows::Forms::CheckBox^ m_checkbox_vissurf_solid; + private: System::Windows::Forms::CheckBox^ m_checkbox_visbound; + private: System::Windows::Forms::CheckBox^ m_checkbox_vissurf_trans; + + private: System::Windows::Forms::Button^ m_btn_flip_normals; + private: System::Windows::Forms::CheckBox^ m_checkbox_visnormals; + private: System::Windows::Forms::Button^ m_copy_to_next_frame; protected: @@ -111,6 +120,14 @@ namespace RoiPainter4D { this->m_btn_sharestroke = (gcnew System::Windows::Forms::Button()); this->m_btn_loadstate = (gcnew System::Windows::Forms::Button()); this->m_btn_savestate = (gcnew System::Windows::Forms::Button()); + this->label6 = (gcnew System::Windows::Forms::Label()); + this->label7 = (gcnew System::Windows::Forms::Label()); + this->m_checkbox_vissurf_solid = (gcnew System::Windows::Forms::CheckBox()); + this->m_checkbox_visbound = (gcnew System::Windows::Forms::CheckBox()); + this->m_checkbox_vissurf_trans = (gcnew System::Windows::Forms::CheckBox()); + this->m_btn_flip_normals = (gcnew System::Windows::Forms::Button()); + this->m_checkbox_visnormals = (gcnew System::Windows::Forms::CheckBox()); + this->m_copy_to_next_frame = (gcnew System::Windows::Forms::Button()); (cli::safe_cast(this->m_numbox_cpsize))->BeginInit(); (cli::safe_cast(this->m_trackbar_mcscale))->BeginInit(); this->SuspendLayout(); @@ -119,9 +136,10 @@ namespace RoiPainter4D { // this->m_btn_convert_mask_mesh->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); - this->m_btn_convert_mask_mesh->Location = System::Drawing::Point(8, 10); + this->m_btn_convert_mask_mesh->Location = System::Drawing::Point(10, 12); + this->m_btn_convert_mask_mesh->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_convert_mask_mesh->Name = L"m_btn_convert_mask_mesh"; - this->m_btn_convert_mask_mesh->Size = System::Drawing::Size(135, 23); + this->m_btn_convert_mask_mesh->Size = System::Drawing::Size(214, 40); this->m_btn_convert_mask_mesh->TabIndex = 0; this->m_btn_convert_mask_mesh->Text = L"Convert mask -> mesh"; this->m_btn_convert_mask_mesh->UseVisualStyleBackColor = true; @@ -129,9 +147,10 @@ namespace RoiPainter4D { // // m_btn_deform // - this->m_btn_deform->Location = System::Drawing::Point(8, 83); + this->m_btn_deform->Location = System::Drawing::Point(10, 283); + this->m_btn_deform->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_deform->Name = L"m_btn_deform"; - this->m_btn_deform->Size = System::Drawing::Size(135, 23); + this->m_btn_deform->Size = System::Drawing::Size(216, 38); this->m_btn_deform->TabIndex = 1; this->m_btn_deform->Text = L"Deform"; this->m_btn_deform->UseVisualStyleBackColor = true; @@ -139,9 +158,10 @@ namespace RoiPainter4D { // // m_btn_undo // - this->m_btn_undo->Location = System::Drawing::Point(8, 145); + this->m_btn_undo->Location = System::Drawing::Point(232, 382); + this->m_btn_undo->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_undo->Name = L"m_btn_undo"; - this->m_btn_undo->Size = System::Drawing::Size(65, 23); + this->m_btn_undo->Size = System::Drawing::Size(86, 38); this->m_btn_undo->TabIndex = 2; this->m_btn_undo->Text = L"UNDO"; this->m_btn_undo->UseVisualStyleBackColor = true; @@ -149,9 +169,10 @@ namespace RoiPainter4D { // // m_btn_redo // - this->m_btn_redo->Location = System::Drawing::Point(80, 145); + this->m_btn_redo->Location = System::Drawing::Point(328, 382); + this->m_btn_redo->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_redo->Name = L"m_btn_redo"; - this->m_btn_redo->Size = System::Drawing::Size(63, 23); + this->m_btn_redo->Size = System::Drawing::Size(84, 38); this->m_btn_redo->TabIndex = 2; this->m_btn_redo->Text = L"REDO"; this->m_btn_redo->UseVisualStyleBackColor = true; @@ -159,19 +180,24 @@ namespace RoiPainter4D { // // m_copy_from_prev_frame // - this->m_copy_from_prev_frame->Location = System::Drawing::Point(149, 145); + this->m_copy_from_prev_frame->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 8)); + this->m_copy_from_prev_frame->Location = System::Drawing::Point(9, 426); + this->m_copy_from_prev_frame->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_copy_from_prev_frame->Name = L"m_copy_from_prev_frame"; - this->m_copy_from_prev_frame->Size = System::Drawing::Size(144, 23); + this->m_copy_from_prev_frame->Size = System::Drawing::Size(216, 38); this->m_copy_from_prev_frame->TabIndex = 1; - this->m_copy_from_prev_frame->Text = L"Copy from prev frame"; + this->m_copy_from_prev_frame->Text = L"Copy strokes from prev frame"; this->m_copy_from_prev_frame->UseVisualStyleBackColor = true; this->m_copy_from_prev_frame->Click += gcnew System::EventHandler(this, &FormRefCurveDeform::m_copy_from_prev_frame_Click); // // m_btn_copy_stroke_all_frame // - this->m_btn_copy_stroke_all_frame->Location = System::Drawing::Point(149, 174); + this->m_btn_copy_stroke_all_frame->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->m_btn_copy_stroke_all_frame->Location = System::Drawing::Point(9, 470); + this->m_btn_copy_stroke_all_frame->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_copy_stroke_all_frame->Name = L"m_btn_copy_stroke_all_frame"; - this->m_btn_copy_stroke_all_frame->Size = System::Drawing::Size(144, 23); + this->m_btn_copy_stroke_all_frame->Size = System::Drawing::Size(216, 38); this->m_btn_copy_stroke_all_frame->TabIndex = 1; this->m_btn_copy_stroke_all_frame->Text = L"Copy strokes to all frame"; this->m_btn_copy_stroke_all_frame->UseVisualStyleBackColor = true; @@ -180,33 +206,34 @@ namespace RoiPainter4D { // m_numbox_cpsize // this->m_numbox_cpsize->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 11.5F)); - this->m_numbox_cpsize->Location = System::Drawing::Point(233, 221); + this->m_numbox_cpsize->Location = System::Drawing::Point(337, 81); + this->m_numbox_cpsize->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_numbox_cpsize->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) { 1, 0, 0, 0 }); this->m_numbox_cpsize->Name = L"m_numbox_cpsize"; - this->m_numbox_cpsize->Size = System::Drawing::Size(57, 23); + this->m_numbox_cpsize->Size = System::Drawing::Size(56, 27); this->m_numbox_cpsize->TabIndex = 25; this->m_numbox_cpsize->TextAlign = System::Windows::Forms::HorizontalAlignment::Right; - this->m_numbox_cpsize->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) { 10, 0, 0, 0 }); + this->m_numbox_cpsize->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) { 3, 0, 0, 0 }); this->m_numbox_cpsize->ValueChanged += gcnew System::EventHandler(this, &FormRefCurveDeform::m_numbox_cpsize_ValueChanged); // // label4 // this->label4->AutoSize = true; - this->label4->Location = System::Drawing::Point(181, 226); + this->label4->Location = System::Drawing::Point(270, 85); + this->label4->Margin = System::Windows::Forms::Padding(4, 0, 4, 0); this->label4->Name = L"label4"; - this->label4->Size = System::Drawing::Size(46, 12); + this->label4->Size = System::Drawing::Size(59, 15); this->label4->TabIndex = 26; this->label4->Text = L"CP size:"; // // m_checkbox_showonlyselectedstroke // this->m_checkbox_showonlyselectedstroke->AutoSize = true; - this->m_checkbox_showonlyselectedstroke->Checked = true; - this->m_checkbox_showonlyselectedstroke->CheckState = System::Windows::Forms::CheckState::Checked; this->m_checkbox_showonlyselectedstroke->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 8)); - this->m_checkbox_showonlyselectedstroke->Location = System::Drawing::Point(149, 250); + this->m_checkbox_showonlyselectedstroke->Location = System::Drawing::Point(240, 114); + this->m_checkbox_showonlyselectedstroke->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_checkbox_showonlyselectedstroke->Name = L"m_checkbox_showonlyselectedstroke"; - this->m_checkbox_showonlyselectedstroke->Size = System::Drawing::Size(148, 15); + this->m_checkbox_showonlyselectedstroke->Size = System::Drawing::Size(181, 18); this->m_checkbox_showonlyselectedstroke->TabIndex = 27; this->m_checkbox_showonlyselectedstroke->Text = L"Show only selected stroke"; this->m_checkbox_showonlyselectedstroke->UseVisualStyleBackColor = true; @@ -216,9 +243,10 @@ namespace RoiPainter4D { // this->m_btn_convert_mesh_mask->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); - this->m_btn_convert_mesh_mask->Location = System::Drawing::Point(8, 245); + this->m_btn_convert_mesh_mask->Location = System::Drawing::Point(125, 530); + this->m_btn_convert_mesh_mask->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_convert_mesh_mask->Name = L"m_btn_convert_mesh_mask"; - this->m_btn_convert_mesh_mask->Size = System::Drawing::Size(135, 23); + this->m_btn_convert_mesh_mask->Size = System::Drawing::Size(180, 38); this->m_btn_convert_mesh_mask->TabIndex = 0; this->m_btn_convert_mesh_mask->Text = L"Convert mesh -> mask"; this->m_btn_convert_mesh_mask->UseVisualStyleBackColor = true; @@ -227,47 +255,52 @@ namespace RoiPainter4D { // m_trackbar_mcscale // this->m_trackbar_mcscale->LargeChange = 1; - this->m_trackbar_mcscale->Location = System::Drawing::Point(147, 10); + this->m_trackbar_mcscale->Location = System::Drawing::Point(225, 12); + this->m_trackbar_mcscale->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_trackbar_mcscale->Maximum = 4; this->m_trackbar_mcscale->Minimum = 1; this->m_trackbar_mcscale->Name = L"m_trackbar_mcscale"; - this->m_trackbar_mcscale->Size = System::Drawing::Size(139, 45); + this->m_trackbar_mcscale->Size = System::Drawing::Size(186, 56); this->m_trackbar_mcscale->TabIndex = 28; this->m_trackbar_mcscale->Value = 2; // // label1 // this->label1->AutoSize = true; - this->label1->Location = System::Drawing::Point(152, 43); + this->label1->Location = System::Drawing::Point(231, 49); + this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0); this->label1->Name = L"label1"; - this->label1->Size = System::Drawing::Size(17, 12); + this->label1->Size = System::Drawing::Size(22, 15); this->label1->TabIndex = 29; this->label1->Text = L"x1"; // // label2 // this->label2->AutoSize = true; - this->label2->Location = System::Drawing::Point(190, 43); + this->label2->Location = System::Drawing::Point(283, 49); + this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0); this->label2->Name = L"label2"; - this->label2->Size = System::Drawing::Size(17, 12); + this->label2->Size = System::Drawing::Size(22, 15); this->label2->TabIndex = 29; this->label2->Text = L"x2"; // // label3 // this->label3->AutoSize = true; - this->label3->Location = System::Drawing::Point(228, 43); + this->label3->Location = System::Drawing::Point(333, 49); + this->label3->Margin = System::Windows::Forms::Padding(4, 0, 4, 0); this->label3->Name = L"label3"; - this->label3->Size = System::Drawing::Size(17, 12); + this->label3->Size = System::Drawing::Size(22, 15); this->label3->TabIndex = 29; this->label3->Text = L"x4"; // // label5 // this->label5->AutoSize = true; - this->label5->Location = System::Drawing::Point(265, 43); + this->label5->Location = System::Drawing::Point(383, 49); + this->label5->Margin = System::Windows::Forms::Padding(4, 0, 4, 0); this->label5->Name = L"label5"; - this->label5->Size = System::Drawing::Size(17, 12); + this->label5->Size = System::Drawing::Size(22, 15); this->label5->TabIndex = 29; this->label5->Text = L"x8"; // @@ -275,9 +308,10 @@ namespace RoiPainter4D { // this->m_btn_reload_mesh->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); - this->m_btn_reload_mesh->Location = System::Drawing::Point(8, 112); + this->m_btn_reload_mesh->Location = System::Drawing::Point(10, 327); + this->m_btn_reload_mesh->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_reload_mesh->Name = L"m_btn_reload_mesh"; - this->m_btn_reload_mesh->Size = System::Drawing::Size(135, 23); + this->m_btn_reload_mesh->Size = System::Drawing::Size(216, 38); this->m_btn_reload_mesh->TabIndex = 0; this->m_btn_reload_mesh->Text = L"Reload mesh"; this->m_btn_reload_mesh->UseVisualStyleBackColor = true; @@ -285,9 +319,10 @@ namespace RoiPainter4D { // // m_btn_sharestroke // - this->m_btn_sharestroke->Location = System::Drawing::Point(8, 174); + this->m_btn_sharestroke->Location = System::Drawing::Point(230, 426); + this->m_btn_sharestroke->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_sharestroke->Name = L"m_btn_sharestroke"; - this->m_btn_sharestroke->Size = System::Drawing::Size(135, 23); + this->m_btn_sharestroke->Size = System::Drawing::Size(180, 38); this->m_btn_sharestroke->TabIndex = 1; this->m_btn_sharestroke->Text = L"Set as all frame curve"; this->m_btn_sharestroke->UseVisualStyleBackColor = true; @@ -295,9 +330,10 @@ namespace RoiPainter4D { // // m_btn_loadstate // - this->m_btn_loadstate->Location = System::Drawing::Point(149, 83); + this->m_btn_loadstate->Location = System::Drawing::Point(230, 283); + this->m_btn_loadstate->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_loadstate->Name = L"m_btn_loadstate"; - this->m_btn_loadstate->Size = System::Drawing::Size(144, 23); + this->m_btn_loadstate->Size = System::Drawing::Size(182, 38); this->m_btn_loadstate->TabIndex = 1; this->m_btn_loadstate->Text = L"Load state"; this->m_btn_loadstate->UseVisualStyleBackColor = true; @@ -305,25 +341,134 @@ namespace RoiPainter4D { // // m_btn_savestate // - this->m_btn_savestate->Location = System::Drawing::Point(149, 112); + this->m_btn_savestate->Location = System::Drawing::Point(230, 327); + this->m_btn_savestate->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->m_btn_savestate->Name = L"m_btn_savestate"; - this->m_btn_savestate->Size = System::Drawing::Size(144, 23); + this->m_btn_savestate->Size = System::Drawing::Size(182, 38); this->m_btn_savestate->TabIndex = 1; this->m_btn_savestate->Text = L"Save state"; this->m_btn_savestate->UseVisualStyleBackColor = true; this->m_btn_savestate->Click += gcnew System::EventHandler(this, &FormRefCurveDeform::m_btn_savestate_Click); // + // label6 + // + this->label6->AutoSize = true; + this->label6->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9)); + this->label6->Location = System::Drawing::Point(237, 203); + this->label6->Margin = System::Windows::Forms::Padding(2, 0, 2, 0); + this->label6->Name = L"label6"; + this->label6->Size = System::Drawing::Size(156, 60); + this->label6->TabIndex = 0; + this->label6->Text = L"[Space key] hide mesh.\r\n[s key] hide stroke.\r\n[d key] show mask.\r\n[v key] show vo" + L"lume."; + // + // label7 + // + this->label7->AutoSize = true; + this->label7->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->label7->Location = System::Drawing::Point(6, 81); + this->label7->Margin = System::Windows::Forms::Padding(2, 0, 2, 0); + this->label7->Name = L"label7"; + this->label7->Size = System::Drawing::Size(241, 51); + this->label7->TabIndex = 0; + this->label7->Text = L"[Shift] show control points(CP). \r\n[R click] make/move a CP. \r\n[L click] remove a" + L" CP."; + // + // m_checkbox_vissurf_solid + // + this->m_checkbox_vissurf_solid->AutoSize = true; + this->m_checkbox_vissurf_solid->Location = System::Drawing::Point(9, 244); + this->m_checkbox_vissurf_solid->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); + this->m_checkbox_vissurf_solid->Name = L"m_checkbox_vissurf_solid"; + this->m_checkbox_vissurf_solid->Size = System::Drawing::Size(148, 19); + this->m_checkbox_vissurf_solid->TabIndex = 32; + this->m_checkbox_vissurf_solid->Text = L"show surface solid"; + this->m_checkbox_vissurf_solid->UseVisualStyleBackColor = true; + this->m_checkbox_vissurf_solid->CheckedChanged += gcnew System::EventHandler(this, &FormRefCurveDeform::m_checkbox_vissurf_solid_CheckedChanged); + // + // m_checkbox_visbound + // + this->m_checkbox_visbound->AutoSize = true; + this->m_checkbox_visbound->Checked = true; + this->m_checkbox_visbound->CheckState = System::Windows::Forms::CheckState::Checked; + this->m_checkbox_visbound->Location = System::Drawing::Point(66, 219); + this->m_checkbox_visbound->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); + this->m_checkbox_visbound->Name = L"m_checkbox_visbound"; + this->m_checkbox_visbound->Size = System::Drawing::Size(124, 19); + this->m_checkbox_visbound->TabIndex = 31; + this->m_checkbox_visbound->Text = L"show boundary"; + this->m_checkbox_visbound->UseVisualStyleBackColor = true; + this->m_checkbox_visbound->CheckedChanged += gcnew System::EventHandler(this, &FormRefCurveDeform::m_checkbox_visbound_CheckedChanged); + // + // m_checkbox_vissurf_trans + // + this->m_checkbox_vissurf_trans->AutoSize = true; + this->m_checkbox_vissurf_trans->Location = System::Drawing::Point(9, 203); + this->m_checkbox_vissurf_trans->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); + this->m_checkbox_vissurf_trans->Name = L"m_checkbox_vissurf_trans"; + this->m_checkbox_vissurf_trans->Size = System::Drawing::Size(152, 19); + this->m_checkbox_vissurf_trans->TabIndex = 30; + this->m_checkbox_vissurf_trans->Text = L"show surface trans"; + this->m_checkbox_vissurf_trans->UseVisualStyleBackColor = true; + this->m_checkbox_vissurf_trans->CheckedChanged += gcnew System::EventHandler(this, &FormRefCurveDeform::m_checkbox_vissurf_CheckedChanged); + // + // m_btn_flip_normals + // + this->m_btn_flip_normals->Location = System::Drawing::Point(122, 149); + this->m_btn_flip_normals->Margin = System::Windows::Forms::Padding(2); + this->m_btn_flip_normals->Name = L"m_btn_flip_normals"; + this->m_btn_flip_normals->Size = System::Drawing::Size(102, 27); + this->m_btn_flip_normals->TabIndex = 30; + this->m_btn_flip_normals->Text = L"flip normals"; + this->m_btn_flip_normals->UseVisualStyleBackColor = true; + this->m_btn_flip_normals->Click += gcnew System::EventHandler(this, &FormRefCurveDeform::m_btn_flip_normals_Click); + // + // m_checkbox_visnormals + // + this->m_checkbox_visnormals->AutoSize = true; + this->m_checkbox_visnormals->Checked = true; + this->m_checkbox_visnormals->CheckState = System::Windows::Forms::CheckState::Checked; + this->m_checkbox_visnormals->Location = System::Drawing::Point(9, 149); + this->m_checkbox_visnormals->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); + this->m_checkbox_visnormals->Name = L"m_checkbox_visnormals"; + this->m_checkbox_visnormals->Size = System::Drawing::Size(116, 19); + this->m_checkbox_visnormals->TabIndex = 31; + this->m_checkbox_visnormals->Text = L"show normals"; + this->m_checkbox_visnormals->UseVisualStyleBackColor = true; + this->m_checkbox_visnormals->CheckedChanged += gcnew System::EventHandler(this, &FormRefCurveDeform::m_checkbox_visnormals_CheckedChanged); + // + // m_copy_to_next_frame + // + this->m_copy_to_next_frame->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 8)); + this->m_copy_to_next_frame->Location = System::Drawing::Point(10, 382); + this->m_copy_to_next_frame->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); + this->m_copy_to_next_frame->Name = L"m_copy_to_next_frame"; + this->m_copy_to_next_frame->Size = System::Drawing::Size(216, 38); + this->m_copy_to_next_frame->TabIndex = 33; + this->m_copy_to_next_frame->Text = L"Copy sel stroke to next frame"; + this->m_copy_to_next_frame->UseVisualStyleBackColor = true; + this->m_copy_to_next_frame->Click += gcnew System::EventHandler(this, &FormRefCurveDeform::m_copy_to_next_frame_Click); + // // FormRefCurveDeform // - this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); + this->AutoScaleDimensions = System::Drawing::SizeF(8, 15); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; - this->ClientSize = System::Drawing::Size(300, 316); + this->ClientSize = System::Drawing::Size(425, 567); + this->Controls->Add(this->m_copy_to_next_frame); + this->Controls->Add(this->label6); + this->Controls->Add(this->m_checkbox_showonlyselectedstroke); + this->Controls->Add(this->m_btn_flip_normals); + this->Controls->Add(this->m_checkbox_vissurf_solid); + this->Controls->Add(this->m_checkbox_visnormals); + this->Controls->Add(this->m_checkbox_visbound); + this->Controls->Add(this->m_checkbox_vissurf_trans); + this->Controls->Add(this->label7); this->Controls->Add(this->label5); this->Controls->Add(this->label3); this->Controls->Add(this->label2); this->Controls->Add(this->label1); this->Controls->Add(this->m_trackbar_mcscale); - this->Controls->Add(this->m_checkbox_showonlyselectedstroke); this->Controls->Add(this->label4); this->Controls->Add(this->m_numbox_cpsize); this->Controls->Add(this->m_btn_redo); @@ -337,6 +482,7 @@ namespace RoiPainter4D { this->Controls->Add(this->m_btn_convert_mesh_mask); this->Controls->Add(this->m_btn_reload_mesh); this->Controls->Add(this->m_btn_convert_mask_mesh); + this->Margin = System::Windows::Forms::Padding(4, 3, 4, 3); this->Name = L"FormRefCurveDeform"; this->Text = L"RefCurveDeform"; (cli::safe_cast(this->m_numbox_cpsize))->EndInit(); @@ -354,18 +500,28 @@ namespace RoiPainter4D { System::Void m_btn_undo_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_btn_redo_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_copy_from_prev_frame_Click(System::Object^ sender, System::EventArgs^ e); + System::Void m_copy_to_next_frame_Click(System::Object^ sender, System::EventArgs^ e) ; System::Void m_btn_convert_mesh_mask_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_btn_copy_stroke_all_frame_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_btn_sharestroke_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_btn_loadstate_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_btn_savestate_Click(System::Object^ sender, System::EventArgs^ e); System::Void m_checkbox_showonlyselectedstroke_CheckedChanged(System::Object^ sender, System::EventArgs^ e); + System::Void m_checkbox_vissurf_CheckedChanged(System::Object^ sender, System::EventArgs^ e); + System::Void m_checkbox_visbound_CheckedChanged(System::Object^ sender, System::EventArgs^ e); + System::Void m_checkbox_vissurf_solid_CheckedChanged(System::Object^ sender, System::EventArgs^ e); + System::Void m_btn_flip_normals_Click(System::Object^ sender, System::EventArgs^ e); + System::Void m_checkbox_visnormals_CheckedChanged(System::Object^ sender, System::EventArgs^ e); public: void LoadState(); void SaveState(); int GetCPSize(); bool GetShowOnlySelectedStroke(); int GetMCScale(); + bool DoVisSurfTrans() { return m_checkbox_vissurf_trans->Checked; } + bool DoVisSurfSolid() { return m_checkbox_vissurf_solid->Checked; } + bool DoVisBound() { return m_checkbox_visbound->Checked; } + bool DoVisNormals() { return m_checkbox_visnormals->Checked; } }; inline void FormRefCurveDeform_Show() { FormRefCurveDeform::GetInst()->Show(); } @@ -376,5 +532,9 @@ namespace RoiPainter4D { inline int FormRefCurveDeform_GetCPSize() { return FormRefCurveDeform::GetInst()->GetCPSize(); } inline bool FormRefCurveDeform_GetShowOnlySelectedStroke() { return FormRefCurveDeform::GetInst()->GetShowOnlySelectedStroke(); } inline int FormRefCurveDeform_GetMCScale() { return FormRefCurveDeform::GetInst()->GetMCScale(); } + inline bool FormRefCurveDeform_bVisBound() {return FormRefCurveDeform::GetInst()->DoVisBound();} + inline bool FormRefCurveDeform_bVisSurfTrans() {return FormRefCurveDeform::GetInst()->DoVisSurfTrans();} + inline bool FormRefCurveDeform_bVisSurfSolid() {return FormRefCurveDeform::GetInst()->DoVisSurfSolid();} + inline bool FormRefCurveDeform_bVisNormals() { return FormRefCurveDeform::GetInst()->DoVisNormals(); } } diff --git a/RoiPainter4D/RoiPainter4D/FormRefPixPaint.cpp b/RoiPainter4D/RoiPainter4D/FormRefPixPaint.cpp new file mode 100644 index 0000000..80a6c77 --- /dev/null +++ b/RoiPainter4D/RoiPainter4D/FormRefPixPaint.cpp @@ -0,0 +1,141 @@ +#pragma managed +#include "FormRefPixPaint.h" +#include "FormSelectMskId.h" + +#pragma unmanaged +#include "./Mode/ModeRefPixPaint.h" +#include "ImageCore.h" +#pragma managed + +using namespace RoiPainter4D; + +System::Void FormRefPixPaint::btn_ok_Click(System::Object^ sender, System::EventArgs^ e) +{ + ModeRefPixPaint::GetInst()->finishTrim(); +} + +System::Void FormRefPixPaint::btn_cancel_Click(System::Object^ sender, System::EventArgs^ e) +{ + ModeRefPixPaint::GetInst()->cancelBtnClick(); +} + +System::Void FormRefPixPaint::InitAllItems(int volmin, int volmax) +{ + m_item_updating = true; + minThresholdBar->SetRange(volmin, volmax); + maxThresholdBar->SetRange(volmin, volmax); + + minThresholdBar->Value = volmin; + maxThresholdBar->Value = volmax; + + minThreshTextBox->Text = minThresholdBar->Value.ToString(); + maxThreshTextBox->Text = maxThresholdBar->Value.ToString(); + m_item_updating = false; + + this->Focus(); + minThreshTextBox->Focus(); + + + FormSelectMskId^ modal = gcnew FormSelectMskId(); + if (modal->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) return; + + int trgtId = modal->getTrgtID(); + modal->Close(); + + ImageCore::GetInst()->SetSelectMaskId(trgtId); +} + +// minV, maxVの値は可能であれば手打ちと、track barを併用してほしい +System::Void FormRefPixPaint::minThreshold_Scroll(System::Object^ sender, System::EventArgs^ e) { + if (m_item_updating) return; + m_item_updating = true; + + minThreshTextBox->Text = minThresholdBar->Value.ToString(); + minThreshTextBox->Refresh(); + + m_item_updating = false; +} + +System::Void FormRefPixPaint::maxThreshold_Scroll(System::Object^ sender, System::EventArgs^ e) { + if (m_item_updating) return; + m_item_updating = true; + + maxThreshTextBox->Text = maxThresholdBar->Value.ToString(); + maxThreshTextBox->Refresh(); + + m_item_updating = false; +} + + + +System::Void FormRefPixPaint::minThreshTextBox_TextChanged(System::Object^ sender, System::EventArgs^ e) +{ + if (m_item_updating) return; + m_item_updating = true; + + + std::cout << "minThreshTextBox_TextChanged\n"; + int x; + if (Int32::TryParse(minThreshTextBox->Text, x)) + { + if (x < minThresholdBar->Minimum) + { + x = minThresholdBar->Minimum; + minThreshTextBox->Text = (x).ToString(); + } + else if (x > minThresholdBar->Maximum) + { + x = minThresholdBar->Maximum; + minThreshTextBox->Text = (x).ToString(); + } + minThresholdBar->Value = x; + } + else if (minThreshTextBox->Text == "-") + { + x = 0; + } + else + { + minThreshTextBox->Text = "0"; + minThresholdBar->Value = 0; + } + + m_item_updating = false; + +} + + + +System::Void FormRefPixPaint::maxThreshTextBox_TextChanged(System::Object^ sender, System::EventArgs^ e) +{ + if (m_item_updating) return; + m_item_updating = true; + + + int x; + if (Int32::TryParse(maxThreshTextBox->Text, x)) + { + if (x < maxThresholdBar->Minimum) + { + x = maxThresholdBar->Minimum; + maxThreshTextBox->Text = (x).ToString(); + } + else if (x > maxThresholdBar->Maximum) + { + x = maxThresholdBar->Maximum; + maxThreshTextBox->Text = (x).ToString(); + } + maxThresholdBar->Value = x; + } + else if (maxThreshTextBox->Text == "-") + { + x = 0; + } + else + { + maxThreshTextBox->Text = "0"; + maxThresholdBar->Value = 0; + } + + m_item_updating = false; +} \ No newline at end of file diff --git a/RoiPainter4D/RoiPainter4D/FormRefPixPaint.h b/RoiPainter4D/RoiPainter4D/FormRefPixPaint.h new file mode 100644 index 0000000..62f7b9e --- /dev/null +++ b/RoiPainter4D/RoiPainter4D/FormRefPixPaint.h @@ -0,0 +1,435 @@ +#pragma once + +namespace RoiPainter4D { + + using namespace System; + using namespace System::ComponentModel; + using namespace System::Collections; + using namespace System::Windows::Forms; + using namespace System::Data; + using namespace System::Drawing; + + /// + /// FormRefPixPaint の概要 + /// + public ref class FormRefPixPaint : public System::Windows::Forms::Form + { + private: + bool m_item_updating; + + System::Windows::Forms::Label^ label1; + System::Windows::Forms::Button^ btn_ok; + System::Windows::Forms::Button^ btn_cancel; + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::Label^ label2; + + private: System::Windows::Forms::Label^ minThreshLabel; + private: System::Windows::Forms::TextBox^ maxThreshTextBox; + private: System::Windows::Forms::Label^ maxThreshLabel; + private: System::Windows::Forms::TextBox^ minThreshTextBox; + private: System::Windows::Forms::TrackBar^ minThresholdBar; + private: System::Windows::Forms::TrackBar^ maxThresholdBar; + private: System::Windows::Forms::RadioButton^ thresholdRadioButton; + + private: System::Windows::Forms::RadioButton^ eraseRadioButton; + + private: System::Windows::Forms::RadioButton^ paintRadioButton; + private: System::Windows::Forms::CheckBox^ m_checkbox_forcedoverwrite; + private: System::Windows::Forms::GroupBox^ groupBox2; + private: System::Windows::Forms::Label^ label3; + private: System::Windows::Forms::GroupBox^ groupBox3; + private: System::Windows::Forms::GroupBox^ groupBox4; + + System::Windows::Forms::CheckBox^ m_checkbox_userough; + + private: + FormRefPixPaint(void) + { + InitializeComponent(); + m_item_updating = false; + this->ControlBox = false; + this->MaximizeBox = false; + } + + static FormRefPixPaint^ m_singleton; + public: + static FormRefPixPaint^ GetInst() { + if (m_singleton == nullptr) { + m_singleton = gcnew FormRefPixPaint(); + } + return m_singleton; + } + + bool DoVisSurf() { return m_checkbox_userough->Checked; } + bool bForcedOverwite() { return m_checkbox_forcedoverwrite->Checked; } + + public: + void InitAllItems(int volmin, int volmax); + bool bPaintMode() { return paintRadioButton->Checked; } + bool bEraseMode() { return eraseRadioButton->Checked; } + bool bThresholdMode() { return thresholdRadioButton->Checked; } + short maxthreshold() { return maxThresholdBar->Value; } + short minthreshold() { return minThresholdBar->Value; } + + protected: + /// + /// 使用中のリソースをすべてクリーンアップします。 + /// + ~FormRefPixPaint() + { + if (components) + { + delete components; + } + } + + private: + /// + /// 必要なデザイナー変数です。 + /// + System::ComponentModel::Container^ components; + +#pragma region Windows Form Designer generated code + /// + /// デザイナー サポートに必要なメソッドです。このメソッドの内容を + /// コード エディターで変更しないでください。 + /// + void InitializeComponent(void) + { + this->label1 = (gcnew System::Windows::Forms::Label()); + this->btn_ok = (gcnew System::Windows::Forms::Button()); + this->btn_cancel = (gcnew System::Windows::Forms::Button()); + this->groupBox1 = (gcnew System::Windows::Forms::GroupBox()); + this->m_checkbox_userough = (gcnew System::Windows::Forms::CheckBox()); + this->label2 = (gcnew System::Windows::Forms::Label()); + this->minThreshLabel = (gcnew System::Windows::Forms::Label()); + this->maxThreshTextBox = (gcnew System::Windows::Forms::TextBox()); + this->maxThreshLabel = (gcnew System::Windows::Forms::Label()); + this->minThreshTextBox = (gcnew System::Windows::Forms::TextBox()); + this->minThresholdBar = (gcnew System::Windows::Forms::TrackBar()); + this->maxThresholdBar = (gcnew System::Windows::Forms::TrackBar()); + this->thresholdRadioButton = (gcnew System::Windows::Forms::RadioButton()); + this->eraseRadioButton = (gcnew System::Windows::Forms::RadioButton()); + this->paintRadioButton = (gcnew System::Windows::Forms::RadioButton()); + this->m_checkbox_forcedoverwrite = (gcnew System::Windows::Forms::CheckBox()); + this->groupBox2 = (gcnew System::Windows::Forms::GroupBox()); + this->label3 = (gcnew System::Windows::Forms::Label()); + this->groupBox3 = (gcnew System::Windows::Forms::GroupBox()); + this->groupBox4 = (gcnew System::Windows::Forms::GroupBox()); + this->groupBox1->SuspendLayout(); + (cli::safe_cast(this->minThresholdBar))->BeginInit(); + (cli::safe_cast(this->maxThresholdBar))->BeginInit(); + this->groupBox2->SuspendLayout(); + this->groupBox3->SuspendLayout(); + this->groupBox4->SuspendLayout(); + this->SuspendLayout(); + // + // label1 + // + this->label1->AutoSize = true; + this->label1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 10.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->label1->Location = System::Drawing::Point(13, 29); + this->label1->Name = L"label1"; + this->label1->Size = System::Drawing::Size(415, 110); + this->label1->TabIndex = 0; + this->label1->Text = L"[Shift L-drag] : draw lasso.\r\n\r\n[R click(mouse)] cancel current stroke.\r\n\r\n[r key" + L"] apply previous lasso to current slice."; + this->label1->Click += gcnew System::EventHandler(this, &FormRefPixPaint::label1_Click); + // + // btn_ok + // + this->btn_ok->Location = System::Drawing::Point(22, 803); + this->btn_ok->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->btn_ok->Name = L"btn_ok"; + this->btn_ok->Size = System::Drawing::Size(218, 75); + this->btn_ok->TabIndex = 1; + this->btn_ok->Text = L"Finish and Store"; + this->btn_ok->UseVisualStyleBackColor = true; + this->btn_ok->Click += gcnew System::EventHandler(this, &FormRefPixPaint::btn_ok_Click); + // + // btn_cancel + // + this->btn_cancel->Location = System::Drawing::Point(317, 803); + this->btn_cancel->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->btn_cancel->Name = L"btn_cancel"; + this->btn_cancel->Size = System::Drawing::Size(133, 75); + this->btn_cancel->TabIndex = 2; + this->btn_cancel->Text = L"Cancel"; + this->btn_cancel->UseVisualStyleBackColor = true; + this->btn_cancel->Click += gcnew System::EventHandler(this, &FormRefPixPaint::btn_cancel_Click); + // + // groupBox1 + // + this->groupBox1->Controls->Add(this->m_checkbox_userough); + this->groupBox1->Controls->Add(this->label2); + this->groupBox1->Location = System::Drawing::Point(22, 525); + this->groupBox1->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox1->Name = L"groupBox1"; + this->groupBox1->Padding = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox1->Size = System::Drawing::Size(462, 270); + this->groupBox1->TabIndex = 3; + this->groupBox1->TabStop = false; + this->groupBox1->Text = L"Other"; + // + // m_checkbox_userough + // + this->m_checkbox_userough->AutoSize = true; + this->m_checkbox_userough->Location = System::Drawing::Point(10, 228); + this->m_checkbox_userough->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->m_checkbox_userough->Name = L"m_checkbox_userough"; + this->m_checkbox_userough->Size = System::Drawing::Size(230, 22); + this->m_checkbox_userough->TabIndex = 1; + this->m_checkbox_userough->Text = L"Render Rough while manip"; + this->m_checkbox_userough->UseVisualStyleBackColor = true; + // + // label2 + // + this->label2->AutoSize = true; + this->label2->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->label2->Location = System::Drawing::Point(8, 22); + this->label2->Name = L"label2"; + this->label2->Size = System::Drawing::Size(319, 180); + this->label2->TabIndex = 0; + this->label2->Text = L"[Ctrl z key] undo operation.\r\n\r\n[Tab key] CT image On/Off.\r\n\r\n[s key] hide mask.\r" + L"\n\r\n[d key] hide previous stroke.\r\n\r\n[Space key] hide volume temporarily."; + this->label2->Click += gcnew System::EventHandler(this, &FormRefPixPaint::label1_Click); + // + // minThreshLabel + // + this->minThreshLabel->AutoSize = true; + this->minThreshLabel->Font = (gcnew System::Drawing::Font(L"游ゴシック", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->minThreshLabel->Location = System::Drawing::Point(12, 29); + this->minThreshLabel->Name = L"minThreshLabel"; + this->minThreshLabel->Size = System::Drawing::Size(48, 26); + this->minThreshLabel->TabIndex = 23; + this->minThreshLabel->Text = L"min"; + // + // maxThreshTextBox + // + this->maxThreshTextBox->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9)); + this->maxThreshTextBox->Location = System::Drawing::Point(71, 64); + this->maxThreshTextBox->Name = L"maxThreshTextBox"; + this->maxThreshTextBox->Size = System::Drawing::Size(74, 25); + this->maxThreshTextBox->TabIndex = 22; + this->maxThreshTextBox->TextChanged += gcnew System::EventHandler(this, &FormRefPixPaint::maxThreshTextBox_TextChanged); + // + // maxThreshLabel + // + this->maxThreshLabel->AutoSize = true; + this->maxThreshLabel->Font = (gcnew System::Drawing::Font(L"游ゴシック", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->maxThreshLabel->Location = System::Drawing::Point(12, 62); + this->maxThreshLabel->Name = L"maxThreshLabel"; + this->maxThreshLabel->Size = System::Drawing::Size(53, 26); + this->maxThreshLabel->TabIndex = 24; + this->maxThreshLabel->Text = L"max"; + // + // minThreshTextBox + // + this->minThreshTextBox->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9)); + this->minThreshTextBox->Location = System::Drawing::Point(71, 31); + this->minThreshTextBox->Name = L"minThreshTextBox"; + this->minThreshTextBox->Size = System::Drawing::Size(74, 25); + this->minThreshTextBox->TabIndex = 21; + this->minThreshTextBox->TextChanged += gcnew System::EventHandler(this, &FormRefPixPaint::minThreshTextBox_TextChanged); + // + // minThresholdBar + // + this->minThresholdBar->Location = System::Drawing::Point(151, 31); + this->minThresholdBar->Name = L"minThresholdBar"; + this->minThresholdBar->Size = System::Drawing::Size(277, 69); + this->minThresholdBar->TabIndex = 25; + this->minThresholdBar->TabStop = false; + this->minThresholdBar->TickStyle = System::Windows::Forms::TickStyle::None; + this->minThresholdBar->Scroll += gcnew System::EventHandler(this, &FormRefPixPaint::minThreshold_Scroll); + // + // maxThresholdBar + // + this->maxThresholdBar->Location = System::Drawing::Point(151, 68); + this->maxThresholdBar->Name = L"maxThresholdBar"; + this->maxThresholdBar->Size = System::Drawing::Size(277, 69); + this->maxThresholdBar->TabIndex = 27; + this->maxThresholdBar->TabStop = false; + this->maxThresholdBar->TickStyle = System::Windows::Forms::TickStyle::None; + this->maxThresholdBar->Scroll += gcnew System::EventHandler(this, &FormRefPixPaint::maxThreshold_Scroll); + // + // thresholdRadioButton + // + this->thresholdRadioButton->AutoSize = true; + this->thresholdRadioButton->Font = (gcnew System::Drawing::Font(L"游ゴシック", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->thresholdRadioButton->Location = System::Drawing::Point(8, 192); + this->thresholdRadioButton->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->thresholdRadioButton->Name = L"thresholdRadioButton"; + this->thresholdRadioButton->Size = System::Drawing::Size(193, 30); + this->thresholdRadioButton->TabIndex = 30; + this->thresholdRadioButton->Text = L"LassoThreshold"; + this->thresholdRadioButton->UseVisualStyleBackColor = true; + // + // eraseRadioButton + // + this->eraseRadioButton->AutoSize = true; + this->eraseRadioButton->Font = (gcnew System::Drawing::Font(L"游ゴシック", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->eraseRadioButton->Location = System::Drawing::Point(214, 154); + this->eraseRadioButton->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->eraseRadioButton->Name = L"eraseRadioButton"; + this->eraseRadioButton->Size = System::Drawing::Size(151, 30); + this->eraseRadioButton->TabIndex = 29; + this->eraseRadioButton->Text = L"LassoErase"; + this->eraseRadioButton->UseVisualStyleBackColor = true; + // + // paintRadioButton + // + this->paintRadioButton->AutoSize = true; + this->paintRadioButton->Checked = true; + this->paintRadioButton->Font = (gcnew System::Drawing::Font(L"游ゴシック", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->paintRadioButton->Location = System::Drawing::Point(10, 154); + this->paintRadioButton->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->paintRadioButton->Name = L"paintRadioButton"; + this->paintRadioButton->Size = System::Drawing::Size(147, 30); + this->paintRadioButton->TabIndex = 28; + this->paintRadioButton->TabStop = true; + this->paintRadioButton->Text = L"LassoPaint"; + this->paintRadioButton->UseVisualStyleBackColor = true; + // + // m_checkbox_forcedoverwrite + // + this->m_checkbox_forcedoverwrite->AutoSize = true; + this->m_checkbox_forcedoverwrite->Location = System::Drawing::Point(8, 241); + this->m_checkbox_forcedoverwrite->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->m_checkbox_forcedoverwrite->Name = L"m_checkbox_forcedoverwrite"; + this->m_checkbox_forcedoverwrite->Size = System::Drawing::Size(329, 22); + this->m_checkbox_forcedoverwrite->TabIndex = 31; + this->m_checkbox_forcedoverwrite->Text = L"Allow forced overwrite of locked voxels."; + this->m_checkbox_forcedoverwrite->UseVisualStyleBackColor = true; + // + // groupBox2 + // + this->groupBox2->Controls->Add(this->label3); + this->groupBox2->Location = System::Drawing::Point(22, 437); + this->groupBox2->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox2->Name = L"groupBox2"; + this->groupBox2->Padding = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox2->Size = System::Drawing::Size(462, 69); + this->groupBox2->TabIndex = 32; + this->groupBox2->TabStop = false; + this->groupBox2->Text = L"Region grow tool"; + // + // label3 + // + this->label3->AutoSize = true; + this->label3->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, + static_cast(128))); + this->label3->Location = System::Drawing::Point(13, 33); + this->label3->Name = L"label3"; + this->label3->Size = System::Drawing::Size(418, 20); + this->label3->TabIndex = 0; + this->label3->Text = L"[Ctrl Shift R click] Region grow 3D current frame\r\n"; + // + // groupBox3 + // + this->groupBox3->Controls->Add(this->label1); + this->groupBox3->Controls->Add(this->paintRadioButton); + this->groupBox3->Controls->Add(this->m_checkbox_forcedoverwrite); + this->groupBox3->Controls->Add(this->eraseRadioButton); + this->groupBox3->Controls->Add(this->thresholdRadioButton); + this->groupBox3->Location = System::Drawing::Point(22, 132); + this->groupBox3->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox3->Name = L"groupBox3"; + this->groupBox3->Padding = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox3->Size = System::Drawing::Size(462, 283); + this->groupBox3->TabIndex = 33; + this->groupBox3->TabStop = false; + this->groupBox3->Text = L"Lasso tool"; + // + // groupBox4 + // + this->groupBox4->Controls->Add(this->maxThresholdBar); + this->groupBox4->Controls->Add(this->minThreshLabel); + this->groupBox4->Controls->Add(this->maxThreshLabel); + this->groupBox4->Controls->Add(this->minThreshTextBox); + this->groupBox4->Controls->Add(this->maxThreshTextBox); + this->groupBox4->Controls->Add(this->minThresholdBar); + this->groupBox4->Location = System::Drawing::Point(22, 13); + this->groupBox4->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox4->Name = L"groupBox4"; + this->groupBox4->Padding = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox4->Size = System::Drawing::Size(462, 101); + this->groupBox4->TabIndex = 32; + this->groupBox4->TabStop = false; + this->groupBox4->Text = L"Threshold setting (Lasso && Region grow)"; + // + // FormRefPixPaint + // + this->AutoScaleDimensions = System::Drawing::SizeF(10, 18); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->ClientSize = System::Drawing::Size(491, 891); + this->Controls->Add(this->groupBox3); + this->Controls->Add(this->groupBox4); + this->Controls->Add(this->groupBox2); + this->Controls->Add(this->groupBox1); + this->Controls->Add(this->btn_cancel); + this->Controls->Add(this->btn_ok); + this->Name = L"FormRefPixPaint"; + this->Text = L"FormRefPixPaint"; + this->Load += gcnew System::EventHandler(this, &FormRefPixPaint::FormRefPixPaint_Load); + this->groupBox1->ResumeLayout(false); + this->groupBox1->PerformLayout(); + (cli::safe_cast(this->minThresholdBar))->EndInit(); + (cli::safe_cast(this->maxThresholdBar))->EndInit(); + this->groupBox2->ResumeLayout(false); + this->groupBox2->PerformLayout(); + this->groupBox3->ResumeLayout(false); + this->groupBox3->PerformLayout(); + this->groupBox4->ResumeLayout(false); + this->groupBox4->PerformLayout(); + this->ResumeLayout(false); + + } +#pragma endregion + private: System::Void FormRefPixPaint_Load(System::Object^ sender, System::EventArgs^ e) { + } + private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { + } + private: System::Void btn_ok_Click(System::Object^ sender, System::EventArgs^ e); + private: System::Void btn_cancel_Click(System::Object^ sender, System::EventArgs^ e); + + + private: System::Void minThreshold_Scroll(System::Object^ sender, System::EventArgs^ e); + private: System::Void maxThreshold_Scroll(System::Object^ sender, System::EventArgs^ e); + private: System::Void minThreshTextBox_TextChanged(System::Object^ sender, System::EventArgs^ e); + private: System::Void maxThreshTextBox_TextChanged(System::Object^ sender, System::EventArgs^ e); + + + }; + + + inline void formRefPixPaint_Hide() + { + FormRefPixPaint::GetInst()->Hide(); + } + inline void formRefPixPaint_Show() + { + FormRefPixPaint::GetInst()->Show(); + } + + inline bool FormRefPixPaint_bUseRoughRend() { + return FormRefPixPaint::GetInst()->DoVisSurf(); + } + inline bool formRefPixPaint_bForcedOverwite() { return FormRefPixPaint::GetInst()->bForcedOverwite(); } + + inline void formRefPixPaint_InitAllItems(int volmin, int volmax) + { + FormRefPixPaint::GetInst()->InitAllItems(volmin, volmax); + } + inline bool formRefPixPaint_bPaintMode() { return FormRefPixPaint::GetInst()->bPaintMode(); } + inline bool formRefPixPaint_bEraseMode() { return FormRefPixPaint::GetInst()->bEraseMode(); } + inline bool formRefPixPaint_bThresholdMode() { return FormRefPixPaint::GetInst()->bThresholdMode(); } + inline short formRefPixPaint_maxThreshValue() { return FormRefPixPaint::GetInst()->maxthreshold(); } + inline short formRefPixPaint_minThreshValue() { return FormRefPixPaint::GetInst()->minthreshold(); } +} diff --git a/RoiPainter4D/RoiPainter4D/FormRefPixPaint.resx b/RoiPainter4D/RoiPainter4D/FormRefPixPaint.resx new file mode 100644 index 0000000..d58980a --- /dev/null +++ b/RoiPainter4D/RoiPainter4D/FormRefPixPaint.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RoiPainter4D/RoiPainter4D/FormRefStrokeTrim.h b/RoiPainter4D/RoiPainter4D/FormRefStrokeTrim.h index b1c918c..46bb614 100644 --- a/RoiPainter4D/RoiPainter4D/FormRefStrokeTrim.h +++ b/RoiPainter4D/RoiPainter4D/FormRefStrokeTrim.h @@ -81,10 +81,9 @@ namespace RoiPainter4D { this->label1->AutoSize = true; this->label1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 10.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); - this->label1->Location = System::Drawing::Point(11, 14); - this->label1->Margin = System::Windows::Forms::Padding(2, 0, 2, 0); + this->label1->Location = System::Drawing::Point(18, 21); this->label1->Name = L"label1"; - this->label1->Size = System::Drawing::Size(219, 75); + this->label1->Size = System::Drawing::Size(318, 110); this->label1->TabIndex = 0; this->label1->Text = L"[Shift L-drag] draw trim stroke.\r\n\r\n[R click] cancel current stroke.\r\n\r\n[Ctrl z k" L"ey] undo trime operation."; @@ -92,9 +91,10 @@ namespace RoiPainter4D { // // btn_ok // - this->btn_ok->Location = System::Drawing::Point(12, 237); + this->btn_ok->Location = System::Drawing::Point(32, 398); + this->btn_ok->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); this->btn_ok->Name = L"btn_ok"; - this->btn_ok->Size = System::Drawing::Size(131, 50); + this->btn_ok->Size = System::Drawing::Size(218, 75); this->btn_ok->TabIndex = 1; this->btn_ok->Text = L"Finish and Store"; this->btn_ok->UseVisualStyleBackColor = true; @@ -102,9 +102,10 @@ namespace RoiPainter4D { // // btn_cancel // - this->btn_cancel->Location = System::Drawing::Point(149, 237); + this->btn_cancel->Location = System::Drawing::Point(260, 398); + this->btn_cancel->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); this->btn_cancel->Name = L"btn_cancel"; - this->btn_cancel->Size = System::Drawing::Size(80, 50); + this->btn_cancel->Size = System::Drawing::Size(133, 75); this->btn_cancel->TabIndex = 2; this->btn_cancel->Text = L"Cancel"; this->btn_cancel->UseVisualStyleBackColor = true; @@ -114,9 +115,11 @@ namespace RoiPainter4D { // this->groupBox1->Controls->Add(this->m_checkbox_userough); this->groupBox1->Controls->Add(this->label2); - this->groupBox1->Location = System::Drawing::Point(26, 109); + this->groupBox1->Location = System::Drawing::Point(43, 164); + this->groupBox1->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); this->groupBox1->Name = L"groupBox1"; - this->groupBox1->Size = System::Drawing::Size(181, 123); + this->groupBox1->Padding = System::Windows::Forms::Padding(5, 4, 5, 4); + this->groupBox1->Size = System::Drawing::Size(302, 226); this->groupBox1->TabIndex = 3; this->groupBox1->TabStop = false; this->groupBox1->Text = L"Display control"; @@ -124,11 +127,10 @@ namespace RoiPainter4D { // m_checkbox_userough // this->m_checkbox_userough->AutoSize = true; - this->m_checkbox_userough->Checked = true; - this->m_checkbox_userough->CheckState = System::Windows::Forms::CheckState::Checked; - this->m_checkbox_userough->Location = System::Drawing::Point(12, 94); + this->m_checkbox_userough->Location = System::Drawing::Point(19, 190); + this->m_checkbox_userough->Margin = System::Windows::Forms::Padding(5, 4, 5, 4); this->m_checkbox_userough->Name = L"m_checkbox_userough"; - this->m_checkbox_userough->Size = System::Drawing::Size(160, 16); + this->m_checkbox_userough->Size = System::Drawing::Size(230, 22); this->m_checkbox_userough->TabIndex = 1; this->m_checkbox_userough->Text = L"Render Rough while manip"; this->m_checkbox_userough->UseVisualStyleBackColor = true; @@ -138,25 +140,23 @@ namespace RoiPainter4D { this->label2->AutoSize = true; this->label2->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); - this->label2->Location = System::Drawing::Point(9, 19); - this->label2->Margin = System::Windows::Forms::Padding(2, 0, 2, 0); + this->label2->Location = System::Drawing::Point(15, 28); this->label2->Name = L"label2"; - this->label2->Size = System::Drawing::Size(162, 65); + this->label2->Size = System::Drawing::Size(245, 140); this->label2->TabIndex = 0; - this->label2->Text = L"[Tab key] CT image On/Off.\r\n\r\n[Space key] hide volume.\r\n\r\n[Ctrl + L-drag] cut str" - L"oke"; + this->label2->Text = L"[Tab key] CT image On/Off.\r\n\r\n[Space key] hide volume.\r\n\r\n[d key] hide mask.\r\n\r\n[" + L"Ctrl + L-drag] cut stroke"; this->label2->Click += gcnew System::EventHandler(this, &FormRefStrokeTrim::label1_Click); // // FormRefStrokeTrim // - this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); + this->AutoScaleDimensions = System::Drawing::SizeF(10, 18); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; - this->ClientSize = System::Drawing::Size(244, 296); + this->ClientSize = System::Drawing::Size(407, 494); this->Controls->Add(this->groupBox1); this->Controls->Add(this->btn_cancel); this->Controls->Add(this->btn_ok); this->Controls->Add(this->label1); - this->Margin = System::Windows::Forms::Padding(2); this->Name = L"FormRefStrokeTrim"; this->Text = L"FormRefStrokeTrim"; this->Load += gcnew System::EventHandler(this, &FormRefStrokeTrim::FormRefStrokeTrim_Load); diff --git a/RoiPainter4D/RoiPainter4D/FormVisMask.h b/RoiPainter4D/RoiPainter4D/FormVisMask.h index ef0bf72..20f7eb4 100644 --- a/RoiPainter4D/RoiPainter4D/FormVisMask.h +++ b/RoiPainter4D/RoiPainter4D/FormVisMask.h @@ -359,7 +359,7 @@ namespace RoiPainter4D { this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(96, 12); this->label1->TabIndex = 25; - this->label1->Text = L"Space: Hide Mask"; + this->label1->Text = L"Shift: Hide Mask"; // // btnThisImpObj // diff --git a/RoiPainter4D/RoiPainter4D/Mode/ModeInterface.h b/RoiPainter4D/RoiPainter4D/Mode/ModeInterface.h index 02fc068..a2b5d62 100644 --- a/RoiPainter4D/RoiPainter4D/Mode/ModeInterface.h +++ b/RoiPainter4D/RoiPainter4D/Mode/ModeInterface.h @@ -16,6 +16,8 @@ enum MODE_ID MODE_REF_STRKTRIM , // ModeRefStrkTrim MODE_REF_CURVEDEFORM,// ModeRefCurveDeform, FormRefCurveDeform (by Yuki Kimura, 2024) + MODE_REF_PIXPAINT, // (by Takahiro Kikuchi, 2024) + MODE_SEG_PIXPAINT , // ModeSegPixPaint MODE_SEG_REGGROW , // ModeSegRegGrow @@ -208,7 +210,7 @@ inline bool IsAltKeyOn () { return GetKeyState(VK_MENU ) < 0; } //inline bool IsAKeyOn () { return GetKeyState(0x41) < 0; } //inline bool IsBKeyOn () { return GetKeyState(0x42) < 0; } inline bool IsCKeyOn () { return GetKeyState(0x43) < 0; } -//inline bool IsDKeyOn () { return GetKeyState(0x44) < 0; } +inline bool IsDKeyOn () { return GetKeyState(0x44) < 0; } //inline bool IsEKeyOn () { return GetKeyState(0x45) < 0; } //inline bool IsFKeyOn () { return GetKeyState(0x46) < 0; } //inline bool IsGKeyOn () { return GetKeyState(0x47) < 0; } @@ -217,7 +219,7 @@ inline bool IsCKeyOn () { return GetKeyState(0x43) < 0; } //inline bool IsJKeyOn () { return GetKeyState(0x4A) < 0; } //inline bool IsKKeyOn () { return GetKeyState(0x4B) < 0; } //inline bool IsLKeyOn () { return GetKeyState(0x4C) < 0; } -inline bool IsMKeyOn () { return GetKeyState(0x4D) < 0; } +//inline bool IsMKeyOn () { return GetKeyState(0x4D) < 0; } //inline bool IsNKeyOn () { return GetKeyState(0x4E) < 0; } //inline bool IsOKeyOn () { return GetKeyState(0x4F) < 0; } //inline bool IsPKeyOn () { return GetKeyState(0x50) < 0; } @@ -226,7 +228,7 @@ inline bool IsMKeyOn () { return GetKeyState(0x4D) < 0; } inline bool IsSKeyOn () { return GetKeyState(0x53) < 0; } //inline bool IsTKeyOn () { return GetKeyState(0x54) < 0; } //inline bool IsUKeyOn () { return GetKeyState(0x55) < 0; } -//inline bool IsVKeyOn () { return GetKeyState(0x56) < 0; } +inline bool IsVKeyOn () { return GetKeyState(0x56) < 0; } //inline bool IsWKeyOn () { return GetKeyState(0x57) < 0; } //inline bool IsXKeyOn () { return GetKeyState(0x58) < 0; } //inline bool IsYKeyOn () { return GetKeyState(0x59) < 0; } diff --git a/RoiPainter4D/RoiPainter4D/Mode/ModeRefCurveDeform.cpp b/RoiPainter4D/RoiPainter4D/Mode/ModeRefCurveDeform.cpp index 4f1a745..7d95e88 100644 --- a/RoiPainter4D/RoiPainter4D/Mode/ModeRefCurveDeform.cpp +++ b/RoiPainter4D/RoiPainter4D/Mode/ModeRefCurveDeform.cpp @@ -2,6 +2,7 @@ #include "ModeRefCurveDeform.h" #include "ModeCommonTools.h" +#include "CagedMeshSequence.h" #include "OglForCLI.h" // openGLを利用するためのクラス #include "ImageCore.h" // 画像データを保持しているクラス   @@ -57,7 +58,7 @@ void ModeRefCurveDeform::StartMode() m_mask_mesh = MaskMeshSequence(); auto c = ImageCore::GetInst()->GetCuboidF(); m_cp_rate = c[0] * 0.0006f; - m_cp_size = 10; + m_cp_size = 3; m_prev_frame_idx = formVisParam_getframeI(); m_strokes = std::vector(ImageCore::GetInst()->GetNumFrames()); m_tmeshes = std::vector(ImageCore::GetInst()->GetNumFrames()); @@ -67,7 +68,7 @@ void ModeRefCurveDeform::StartMode() //} m_shared_stroke_idxs = std::set(); m_histories = std::vector(ImageCore::GetInst()->GetNumFrames()); - m_show_only_selected_stroke = true; + m_show_only_selected_stroke = FormRefCurveDeform_GetShowOnlySelectedStroke(); m_prev_selected_stroke_idx = -1; m_draw_surf_trans = true; m_exist_mesh = false; @@ -84,23 +85,26 @@ void ModeRefCurveDeform::LBtnDown(const EVec2i& p, OglForCLI* ogl) m_bL = true; const int frame_idx = formVisParam_getframeI(); - if (IsShiftKeyOn()) + if (IsShiftKeyOn() && m_mask_mesh.is_initialized) { - Do(); + Do(); //undo,redo処理 + TMesh& mesh = m_mask_mesh.GetMesh(frame_idx); EVec3f ray_pos, ray_dir, pos; ogl->GetCursorRay(p, ray_pos, ray_dir); - const int selected_stroke_idx = m_strokes[frame_idx].PickCPs(ray_pos, ray_dir, m_cp_rate * m_cp_size, false, m_show_only_selected_stroke); + const int selected_stroke_idx = m_strokes[frame_idx].PickCPs(ray_pos, ray_dir, m_cp_rate * m_cp_size, false, m_show_only_selected_stroke); //CPを選択してるかチェック if (selected_stroke_idx == -1) { DeformationStrokes& dstroke = m_strokes[frame_idx]; if (PickCrssec(ray_pos, ray_dir, pos) != CRSSEC_NON) { + const int nearest_vertex_idx = mesh.GetNearestVertexIdx(pos); + const EVec3f nearest_vertex_normal = mesh.m_vNorms[nearest_vertex_idx]; if (dstroke.GetSelectedStrokeIdx() == -1) { dstroke.AddNewStroke(); } - if (!dstroke.AddCP_SelStroke(pos)) + if (!dstroke.AddCP_SelStroke(pos, nearest_vertex_normal)) { dstroke.UnselectStroke(); m_prev_selected_stroke_idx = -1; @@ -400,9 +404,9 @@ void ModeRefCurveDeform::DrawScene( //ImageCore::GetInst()->UpdateImgMaskColor(); ImageCore::GetInst()->BindAllVolumes(); - DrawCrossSectionsNormal(); + DrawCrossSectionsVisFore(IsDKeyOn()); - if (IsMKeyOn() && formVisParam_bRendVol()) + if (IsVKeyOn()) { DrawVolumeVisMask(!IsShiftKeyOn(), cam_pos, cam_cnt); } @@ -411,16 +415,52 @@ void ModeRefCurveDeform::DrawScene( glDisable(GL_BLEND); glEnable(GL_CULL_FACE); + + // draw mesh - if (!IsSpaceKeyOn()) + const EVec3f cuboid = ImageCore::GetCuboid(); + bool draw_bound = FormRefCurveDeform_bVisBound(); + bool draw_surf_trans = FormRefCurveDeform_bVisSurfTrans(); + bool draw_surf_solid = FormRefCurveDeform_bVisSurfSolid(); + const bool b_xy = formVisParam_bPlaneXY(); + const bool b_yz = formVisParam_bPlaneYZ(); + const bool b_zx = formVisParam_bPlaneZX(); + if (!IsSpaceKeyOn() && m_exist_mesh && (draw_bound || draw_surf_trans)) + { + //draw cage & mesh + glDisable(GL_CULL_FACE); + glDepthMask(false); + glEnable(GL_BLEND); + + float planexy = b_xy ? CrssecCore::GetInst()->GetPlanePosXY() : -1; + float planeyz = b_yz ? CrssecCore::GetInst()->GetPlanePosYZ() : -1; + float planezx = b_zx ? CrssecCore::GetInst()->GetPlanePosZX() : -1; + if (!draw_bound) + { + planexy = planeyz = planezx = -1; + } + + float opacity = draw_surf_trans ? (float)0.4 : (float)0; + const auto& m = m_mask_mesh.GetMesh(frame_idx); + DrawMeshWithCrossecHL(m, planeyz, planezx, planexy, opacity, cuboid); + + glDepthMask(true); + glDisable(GL_BLEND); + glEnable(GL_CULL_FACE); + } + //draw mesh (solid) + if (!IsSpaceKeyOn() && m_exist_mesh && draw_surf_solid) { - m_mask_mesh.DrawMesh(frame_idx); + glDisable(GL_CULL_FACE); + const auto& m = m_mask_mesh.GetMesh(frame_idx); + DrawMeshWithCrossecHL(m, -1, -1, -1, 1.0f, cuboid); } + // draw stroke if (!IsSKeyOn()) { - m_strokes[frame_idx].DrawStrokes(m_show_only_selected_stroke); + m_strokes[frame_idx].DrawStrokes(m_show_only_selected_stroke, FormRefCurveDeform_bVisNormals()); for (int i = 0; i < m_matched_pos.size(); ++i) { @@ -579,6 +619,7 @@ void ModeRefCurveDeform::ConvertMeshToMask() formMain_RedrawMainPanel(); formMain_ActivateMainForm(); m_is_not_saved_state = false; + std::cout << "\n" << "\n" << "finished ConvertMeshToMask." << "\n"; } @@ -614,6 +655,28 @@ void ModeRefCurveDeform::CopyFromPrevFrame() } +void ModeRefCurveDeform::CopyToNextFrame() +{ + const int frame_idx = formVisParam_getframeI(); + const int num_frames = ImageCore::GetInst()->GetNumFrames(); + DeformationStrokes& dstrokes = m_strokes[frame_idx]; + + if (dstrokes.GetSelectedStrokeIdx() == -1) return; + if (frame_idx < 0) return; + if (frame_idx >= num_frames -1) return; + if (dstrokes.bSelStrokeShared() ) return; + + dstrokes.CleanStrokesNormalsSide(); + DeformationStrokes& dstrokes_next = m_strokes[frame_idx +1]; + dstrokes_next.AddNewStroke( dstrokes.CloneSelStroke() ); + + std::cout << "Copy to next frame.\n"; + Do(); + formMain_RedrawMainPanel(); + formMain_ActivateMainForm(); +} + + void ModeRefCurveDeform::CopyStrokesToAllFrame() { const int frame_idx = formVisParam_getframeI(); @@ -693,7 +756,7 @@ void ModeRefCurveDeform::FindClosestPointFromStroke(const int _frame_idx, std::v commonXYZ == 1 ? 1.0f : 0.0f, commonXYZ == 2 ? 1.0f : 0.0f ); - + const bool normals_side = m_strokes[_frame_idx].GetStrokeNormalsSide(i); #ifdef DEBUG_MODE_REF_CURVEDEFORM std::cout << "num_p: " << num_p << "\n"; #endif @@ -739,12 +802,21 @@ void ModeRefCurveDeform::FindClosestPointFromStroke(const int _frame_idx, std::v const EVec3f& p_next = idx < num_p - 1 ? stroke[idx + 1] : stroke[num_p - 1]; const EVec3f vec1 = (p_next - p_prev).normalized(); const EVec3f vec2 = vec0.cross(vec1).normalized(); + EVec3f tangent; + if (idx == 0) tangent = stroke[idx + 1] - stroke[idx]; + else if (idx == stroke.size() - 1) tangent = stroke[idx] - stroke[idx - 1]; + else tangent = stroke[idx + 1] - stroke[idx - 1]; + tangent.normalize(); + EVec3f stroke_normal = vec0.cross(tangent); + stroke_normal.normalize(); + stroke_normal *= (normals_side ? 1.0f : -1.0f); // get nearest vertex idx float dist_max = FLT_MAX; int idx_max = -1; for (int k = 0; k < mesh.m_vSize; ++k) { + if (mesh.m_vNorms[k].dot(stroke_normal) <= 0.0f) continue; const EVec3f diff = p - mesh.m_vVerts[k]; Eigen::MatrixXf mat = powf(5.0f, 2.0f) * vec0 * vec0.transpose() @@ -835,6 +907,8 @@ void ModeRefCurveDeform::SaveState(const std::string& _fpath, const std::set&); void LoadState(const std::string&, const std::set&); + void FlipSelectedStrokeNormalSide(); void ShareSelectedStroke(); void UnshareSelectedStroke(); void LockSelectedStroke(); diff --git a/RoiPainter4D/RoiPainter4D/Mode/ModeRefPixPaint.cpp b/RoiPainter4D/RoiPainter4D/Mode/ModeRefPixPaint.cpp new file mode 100644 index 0000000..0dce0a3 --- /dev/null +++ b/RoiPainter4D/RoiPainter4D/Mode/ModeRefPixPaint.cpp @@ -0,0 +1,637 @@ + + +#pragma unmanaged +#include "ModeRefPixPaint.h" + +#pragma managed +#include "FormMain.h" +#include "FormVisParam.h" +#include "FormRefPixPaint.h" +#include "FormSelectMskId.h" +#include "FormVisMask.h" +#include "CliMessageBox.h" +#pragma unmanaged + +#include "ImageCore.h" +#include "CrsSecCore.h" +#include "ModeCore.h" +#include "ModeCommonTools.h" +#include "tqueue.h" + +using namespace RoiPainter4D; + + +ModeRefPixPaint::ModeRefPixPaint() +{ + std::cout << "ModeRefPixPaint...\n"; + m_bL = m_bR = m_bM = false; + m_b_drawlasso = false; + m_b_modified = false; + + std::cout << "ModeRefPixPaint DONE\n"; +} + + +ModeRefPixPaint::~ModeRefPixPaint() +{ +} + + +bool ModeRefPixPaint::CanEndMode() +{ + if (!m_b_modified) return true; + + else return ShowMsgDlgYesNo(MESSAGE_TRUSH_LEAVE, "Leaving?"); + return true; +} + + + +void ModeRefPixPaint::StartMode() +{ + const int fi = formVisParam_getframeI(); + + m_bL = m_bR = m_bM = false; + m_b_drawlasso = false; + m_b_modified = false; + m_trgt_crssecid = CRSSEC_NON; + m_b_draw_crssec = true; + m_lasso.clear(); + m_lasso_previous.clear(); + m_msk3D_pre_fi = fi; + + formRefPixPaint_Show(); + EVec2i minmax = ImageCore::GetInst()->GetVolumeMinMax(); + formRefPixPaint_InitAllItems(minmax[0], minmax[1]); + + //get target mask id + int maskID = ImageCore::GetInst()->GetSelectMaskIdx(); + if (maskID == -1) + { + ModeCore::GetInst()->ModeSwitch(MODE_VIS_NORMAL); + return; + } + + if (maskID == 0) + { + ShowMsgDlg_OK("0th region (background) cannot be trimmed", "caution"); + ModeCore::GetInst()->ModeSwitch(MODE_VIS_NORMAL); + return; + } + + const auto& maskdata = ImageCore::GetInst()->GetMaskData(); + if (maskdata[maskID].lock) + { + ShowMsgDlg_OK("Lockのかかったmask IDを変更しようとしています", "caution"); + } + + + formRefPixPaint_Show(); + + //initialzie vFlg + ImageCore::GetInst()->InitializeFlg4dByMask(formMain_SetProgressValue); + + //update flg 4d + const int num_frames = ImageCore::GetInst()->GetNumFrames(); + const int num_voxels = ImageCore::GetInst()->GetNumVoxels(); + const std::vector& flg4d = ImageCore::GetInst()->m_flg4d; + std::vector& mask4d = ImageCore::GetInst()->m_mask4d; + +#pragma omp parallel for + for (int f = 0; f < num_frames; ++f) + { + byte* flg3d = flg4d[f]; + byte* msk3d = mask4d[f]; + for (int i = 0; i < num_voxels; ++i) + { + //flg3d[i] = (msk3d[i] == maskID) ? 255 : 1; + if (msk3d[i] == maskID)flg3d[i] = 255; + } + } + + //4D volume (cpu) --> vis volume (gpu) + UpdateImageCoreVisVolumes(); + + + if (m_msk3D_pre) delete[] m_msk3D_pre; + m_msk3D_pre = new byte[num_voxels]; + memcpy(m_msk3D_pre, &flg4d[fi][0], sizeof(byte) * num_voxels); + + std::cout << "finish start mode!!!!\n"; +} + + + + +/////////////////////////////////////////////////////////////////////////////// +//Functions for Lasso ///////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +template +static bool IsInRange(const T& val, const T& minv, const T& maxv) { + return minv <= val && val <= maxv; +} + +//注目している点が lasso の内側であるか判定 +static bool t_IsInsideLasso +( + const EVec3f& pos, + const std::vector& lasso_stroke, + const CRSSEC_ID& id +) +{ + const int N = (int)lasso_stroke.size(); + + EVec3f axis = (id == CRSSEC_XY) ? EVec3f(0, 0, 1) : + (id == CRSSEC_YZ) ? EVec3f(1, 0, 0) : EVec3f(0, 1, 0); + + double sum = 0; + for (int i = 0; i < N; ++i) + { + sum += CalcAngle(lasso_stroke[i] - pos, lasso_stroke[(i == N - 1) ? 0 : i + 1] - pos, axis); + } + + return fabs(2 * M_PI - fabs(sum)) < M_PI * 0.5; +} + + + +//lassoの内側にあるvoxelを fore/backに変更 +//b_fore = true --> vFlg 1 --> 255に +//b_fore = false --> vFlg 255 --> 1に +void ModeRefPixPaint::t_addPixsInsideLasso +( + const CRSSEC_ID id, + const EVec3i reso, + const EVec3f pitch, + const std::vector& lasso_stroke +) +{ + const int fi = formVisParam_getframeI(); + std::vector& flg4d = ImageCore::GetInst()->m_flg4d; + const short* img3d = ImageCore::GetInst()->m_img4d[fi]; + std::vector& img4D_flg = ImageCore::GetInst()->m_flg4d; + byte* vol_flg = flg4d[fi]; + + const short maxv = formRefPixPaint_maxThreshValue(); + const short minv = formRefPixPaint_minThreshValue(); + + const int W = reso[0]; + const int H = reso[1]; + const int D = reso[2], WH = W * H; + std::vector lasso; + const int new_num = std::max(10, std::min((int)lasso_stroke.size(), (int)(VertsLength(lasso_stroke, true) / pitch[0]))); + + memcpy(m_msk3D_pre, &img4D_flg[fi][0], sizeof(byte) * reso[0] * reso[1] * reso[2]); + m_msk3D_pre_fi = fi; + + VertsResampleEqualInterval(new_num, lasso_stroke, lasso); + + //compute bounding box + EVec3f tmp_min, tmp_max; + CalcBoundingBox(lasso, tmp_min, tmp_max); + EVec3i bb_min((int)(tmp_min[0] / pitch[0]), (int)(tmp_min[1] / pitch[1]), (int)(tmp_min[2] / pitch[2])); + EVec3i bb_max((int)(tmp_max[0] / pitch[0]), (int)(tmp_max[1] / pitch[1]), (int)(tmp_max[2] / pitch[2])); + bb_min[0] = std::max(0, bb_min[0] - 1); + bb_min[1] = std::max(0, bb_min[1] - 1); + bb_min[2] = std::max(0, bb_min[2] - 1); + bb_max[0] = std::min(W - 1, bb_max[0] + 1); + bb_max[1] = std::min(H - 1, bb_max[1] + 1); + bb_max[2] = std::min(D - 1, bb_max[2] + 1); + + if (id == CRSSEC_XY) + { + const float zpos = lasso.front()[2]; + const int zi = (int)(zpos / pitch[2]); + +#pragma omp parallel for + for (int yi = bb_min[1]; yi < bb_max[1]; ++yi) + { + for (int xi = bb_min[0]; xi < bb_max[0]; ++xi) + { + int idx = xi + yi * W + zi * WH; + if (vol_flg[idx] == 0 && !formRefPixPaint_bForcedOverwite()) continue; + if (formRefPixPaint_bPaintMode() && vol_flg[idx] == 255) continue; + if (formRefPixPaint_bEraseMode() && vol_flg[idx] == 1) continue; + + EVec3f p((xi + 0.5f) * pitch[0], (yi + 0.5f) * pitch[1], zpos); + if (t_IsInsideLasso(p, lasso, id)) + vol_flg[idx] = formRefPixPaint_bPaintMode() ? 255 : + formRefPixPaint_bEraseMode() ? 1 : + IsInRange(img3d[idx], minv, maxv) ? 255 : 1; + } + } + } + + if (id == CRSSEC_YZ) + { + const float xpos = lasso.front()[0]; + const int xi = (int)(xpos / pitch[0]); + + #pragma omp parallel for + for (int zi = bb_min[2]; zi < bb_max[2]; ++zi) + { + for (int yi = bb_min[1]; yi < bb_max[1]; ++yi) + { + int idx = xi + yi * W + zi * WH; + if (vol_flg[idx] == 0 && !formRefPixPaint_bForcedOverwite()) continue; + if (formRefPixPaint_bPaintMode() && vol_flg[idx] == 255) continue; + if (formRefPixPaint_bEraseMode() && vol_flg[idx] == 1) continue; + EVec3f p(xpos, (yi + 0.5f) * pitch[1], (zi + 0.5f) * pitch[2]); + if (t_IsInsideLasso(p, lasso, id)) + vol_flg[idx] = formRefPixPaint_bPaintMode() ? 255 : + formRefPixPaint_bEraseMode() ? 1 : + IsInRange(img3d[idx], minv, maxv) ? 255 : 1; + } + } + } + + if (id == CRSSEC_ZX) + { + const float ypos = lasso.front()[1]; + const int yi = (int)(ypos / pitch[1]); + + #pragma omp parallel for + for (int zi = bb_min[2]; zi < bb_max[2]; ++zi) + { + for (int xi = bb_min[0]; xi < bb_max[0]; ++xi) + { + int idx = xi + yi * W + zi * WH; + if (vol_flg[idx] == 0 && !formRefPixPaint_bForcedOverwite()) continue; + if (formRefPixPaint_bPaintMode() && vol_flg[idx] == 255) continue; + if (formRefPixPaint_bEraseMode() && vol_flg[idx] == 1) continue; + + EVec3f p((xi + 0.5f) * pitch[0], ypos, (zi + 0.5f) * pitch[2]); + if (t_IsInsideLasso(p, lasso, id)) + vol_flg[idx] = formRefPixPaint_bPaintMode() ? 255 : + formRefPixPaint_bEraseMode() ? 1 : + IsInRange(img3d[idx], minv, maxv) ? 255 : 1; + + } + } + } +} + + + + + +void ModeRefPixPaint::RunRegionGrow3D_OneFrame(const short minv, const short maxv, const EVec3f pos) +{ + const int frameI = formVisParam_getframeI(); + const EVec3i reso = ImageCore::GetInst()->GetReso(); + std::vector& img4D_flg = ImageCore::GetInst()->m_flg4d; + memcpy(m_msk3D_pre, &img4D_flg[frameI][0], sizeof(byte) * reso[0] * reso[1] * reso[2]); + m_msk3D_pre_fi = frameI; + + + std::cout << "runRegionGrow6...\n"; + + int W, H, D, WH, WHD; + std::tie(W, H, D, WH, WHD) = ImageCore::GetInst()->GetResolution5(); + const int num_frames = ImageCore::GetInst()->GetNumFrames(); + const int num_voxels = ImageCore::GetInst()->GetNumVoxels(); + const short* img3d = ImageCore::GetInst()->m_img4d[frameI]; + byte* flg3d = ImageCore::GetInst()->m_flg4d[frameI]; + + if (frameI < 0 || num_frames <= frameI) + { + std::cout << "strange input!\n"; + return; + } + + ////volFlg : 0:never change, 1:back, 255:fore//ModeSegRGrow::RunRegionGrow3D_OneFrameではこの処理をするが、ここではしないでおく。 + //for (int i = 0; i < WHD; ++i) + //{ + // flg3d[i] = (flg3d[i] == 0) ? 0 : 1; + //} + + + //CP --> pixel id + TQueue Q; + const int I = ImageCore::GetInst()->GetVoxelIndex(pos); + + if (flg3d[I] != 0 && IsInRange(img3d[I], minv, maxv)) + { + Q.push_back(PixIdx4D(I, frameI)); + flg3d[I] = 255; + } + + //growing + while (!Q.empty()) + { + const int I = Q.front().idx; + const int x = I % W; + const int y = (I / W) % H; + const int z = I / WH; + const int f = Q.front().frameI; + Q.pop_front(); + + //grow to 8 neighbors + int K; + K = I - 1; if (x > 0 && flg3d[K] == 1 && IsInRange(img3d[K], minv, maxv)) { flg3d[K] = 255; Q.push_back(PixIdx4D(K, f)); } + K = I - W; if (y > 0 && flg3d[K] == 1 && IsInRange(img3d[K], minv, maxv)) { flg3d[K] = 255; Q.push_back(PixIdx4D(K, f)); } + K = I - WH; if (z > 0 && flg3d[K] == 1 && IsInRange(img3d[K], minv, maxv)) { flg3d[K] = 255; Q.push_back(PixIdx4D(K, f)); } + K = I + 1; if (x < W - 1 && flg3d[K] == 1 && IsInRange(img3d[K], minv, maxv)) { flg3d[K] = 255; Q.push_back(PixIdx4D(K, f)); } + K = I + W; if (y < H - 1 && flg3d[K] == 1 && IsInRange(img3d[K], minv, maxv)) { flg3d[K] = 255; Q.push_back(PixIdx4D(K, f)); } + K = I + WH; if (z < D - 1 && flg3d[K] == 1 && IsInRange(img3d[K], minv, maxv)) { flg3d[K] = 255; Q.push_back(PixIdx4D(K, f)); } + } + + std::cout << "runRegionGrow6...DONE\n\n"; +} + + + + + + + + +//////////////////////////////////////////////////////////////////////////// +//MouseListener///////////////////////////////////////////////////////////// +void ModeRefPixPaint::LBtnDown(const EVec2i& p, OglForCLI* ogl) +{ + m_bL = true; + + if (IsShiftKeyOn()) + { + m_b_drawlasso = false; + EVec3f ray_pos, ray_dir, pos; + ogl->GetCursorRay(p, ray_pos, ray_dir); + m_trgt_crssecid = PickCrssec(ray_pos, ray_dir, pos); + if (m_trgt_crssecid != CRSSEC_NON) m_b_drawlasso = true; + } + else + { + ogl->BtnDown_Trans(p); + } + +} + + + +void ModeRefPixPaint::RBtnDown(const EVec2i& p, OglForCLI* ogl) +{ + if (m_bL && m_b_drawlasso) + { + m_bL = false; + m_b_drawlasso = false; + m_lasso.clear(); + } + else if (IsShiftKeyOn()&&IsCtrKeyOn()) + { + EVec3f rayP, rayD, pos; + ogl->GetCursorRay(p, rayP, rayD); + if (PickCrssec(rayP, rayD, pos) != CRSSEC_NON) { + const short maxv = formRefPixPaint_maxThreshValue(); + const short minv = formRefPixPaint_minThreshValue(); + RunRegionGrow3D_OneFrame(minv, maxv, pos); + UpdateImageCoreVisVolumes(); + formMain_RedrawMainPanel(); + m_b_modified = true; + } + } + m_bR = true; + ogl->BtnDown_Rot(p); +} + +void ModeRefPixPaint::LBtnUp(const EVec2i& p, OglForCLI* ogl) +{ + const EVec3i reso = ImageCore::GetInst()->GetReso(); + const EVec3f pitch = ImageCore::GetInst()->GetPitch(); + + if (m_b_drawlasso) + { + t_addPixsInsideLasso(m_trgt_crssecid, reso, pitch, m_lasso); + m_lasso_previous = m_lasso; + m_b_modified = true; + UpdateImageCoreVisVolumes(); + } + + m_bL = false; + m_b_drawlasso = false; + m_lasso.clear(); + ogl->BtnUp(); + + formMain_RedrawMainPanel(); +} + +void ModeRefPixPaint::RBtnUp(const EVec2i& p, OglForCLI* ogl) +{ + m_bR = false; + ogl->BtnUp(); + formMain_RedrawMainPanel(); +} + + +void ModeRefPixPaint::MBtnDown(const EVec2i& p, OglForCLI* ogl) +{ + m_bM = true; + ogl->BtnDown_Zoom(p); +} + + +void ModeRefPixPaint::MBtnUp(const EVec2i& p, OglForCLI* ogl) +{ + m_bM = false; + ogl->BtnUp(); + formMain_RedrawMainPanel(); +} + + +void ModeRefPixPaint::MouseMove(const EVec2i& p, OglForCLI* ogl) +{ + EVec3f rayP, rayD, pos; + ogl->GetCursorRay(p, rayP, rayD); + CRSSEC_ID id = PickCrssec(rayP, rayD, pos); + if (id != CRSSEC_NON) + { + int frame_idx = formVisParam_getframeI(); + short v = ImageCore::GetInst()->GetVoxelValue(frame_idx, pos); + std::cout << v << "\n"; + } + + + + if (!m_bL && !m_bR && !m_bM) return; + + + + if (m_b_drawlasso) + { + if (PickCrssec(m_trgt_crssecid, rayP, rayD, pos) != CRSSEC_NON) m_lasso.push_back(pos); + } + else + { + ogl->MouseMove(p); + } + + formMain_RedrawMainPanel(); +} + + +void ModeRefPixPaint::MouseWheel(const EVec2i& p, short z_delta, OglForCLI* ogl) +{ + bool wheeling = WheelingCrssec(p, z_delta, ogl); + + if (!wheeling) { + ogl->ZoomCamera(z_delta * 0.1f); + } + else + { + EVec3f rayP, rayD, pos; + ogl->GetCursorRay(p, rayP, rayD); + const CRSSEC_ID mouse_id = PickCrssec(rayP, rayD, pos); + if (mouse_id != CRSSEC_NON && mouse_id == m_trgt_crssecid) + { + const int crssecid = (m_trgt_crssecid == CRSSEC_XY) ? 2 : + (m_trgt_crssecid == CRSSEC_YZ) ? 0 : 1; + for (int i = 0; i < m_lasso_previous.size(); ++i) { m_lasso_previous[i][crssecid] = pos[crssecid]; } + } + } + + formMain_RedrawMainPanel(); +} + + +void ModeRefPixPaint::LBtnDclk(const EVec2i& p, OglForCLI* ogl) {} +void ModeRefPixPaint::RBtnDclk(const EVec2i& p, OglForCLI* ogl) {} +void ModeRefPixPaint::MBtnDclk(const EVec2i& p, OglForCLI* ogl) {} + + +void ModeRefPixPaint::KeyDown(int nChar) +{ + if (nChar == 'Z' && IsCtrKeyOn()) + { + const int fi = formVisParam_getframeI(); + + if (fi == m_msk3D_pre_fi || ShowMsgDlgYesNo("現在のフレームではないフレームを変更しようとしています.\nよろしいですか?", "caution")) + { + std::cout << "undo!!"; + const int num_voxels = ImageCore::GetInst()->GetNumVoxels(); + std::vector& flg4d = ImageCore::GetInst()->m_flg4d; + memcpy(&flg4d[m_msk3D_pre_fi][0], m_msk3D_pre, sizeof(byte) * num_voxels); + UpdateImageCoreVisVolumes(); + + } + } + else if (nChar == VK_TAB) + { + m_b_draw_crssec = !m_b_draw_crssec; + } + else if (nChar == 'R') { + std::vector& flg4d = ImageCore::GetInst()->m_flg4d; + const EVec3i reso = ImageCore::GetInst()->GetReso(); + const EVec3f pitch = ImageCore::GetInst()->GetPitch(); + t_addPixsInsideLasso(m_trgt_crssecid, reso, pitch, m_lasso_previous); + UpdateImageCoreVisVolumes(); + + formMain_RedrawMainPanel(); + } +} + +void ModeRefPixPaint::KeyUp(int nChar) +{ +} + + + +void ModeRefPixPaint::DrawScene(const EVec3f& cam_pos, const EVec3f& cam_cnt) +{ + ImageCore::GetInst()->BindAllVolumes(); + + if (m_b_drawlasso && m_lasso.size() > 0) + DrawPolyLine(EVec3f(1, 0, 1), 4, m_lasso, true); + + if (m_lasso_previous.size() > 0 && !IsDKeyOn()) + DrawPolyLine(EVec3f(1, 1, 1), 4, m_lasso_previous, true); + + if (m_b_draw_crssec) + DrawCrossSectionsVisFore(!IsSKeyOn()); + + if (formVisParam_bRendVol()) + { + DrawVolumeVisFore(!IsSpaceKeyOn(), cam_pos, cam_cnt, FormRefPixPaint_bUseRoughRend()); + } +} + + + + + + + + +void t_calcBoundBox2(const std::vector& vs, EVec2i& minBB, EVec2i& maxBB) +{ + if (vs.size() <= 0) return; + minBB << vs.front().x(), vs.front().y(); + maxBB << vs.front().x(), vs.front().y(); + for (const auto& v : vs) + { + minBB[0] = std::min(v.x(), minBB[0]); + minBB[1] = std::min(v.y(), minBB[1]); + maxBB[0] = std::max(v.x(), maxBB[0]); + maxBB[1] = std::max(v.y(), maxBB[1]); + } +} + + + + +void ModeRefPixPaint::finishTrim() +{ + + if (!m_b_modified) + { + ShowMsgDlg_OK("編集された領域が存在しません.\n No edited voxel exist", "no trimmed."); + return; + } + + //このタイミングでfalseにしないとcanEndModeでダイアログが表示される + m_b_modified = false; + + ImageCore::GetInst()->mask_storeCurrentForeGround(); + + + int maskID = ImageCore::GetInst()->GetSelectMaskIdx(); + //maskを入れ替えたい + //①maskIDのまま残っているボクセルを新しく作るmaskに入れる。 + //initialzie vFlg + ImageCore::GetInst()->InitializeFlg4dByMask(formMain_SetProgressValue); + const int num_frames = ImageCore::GetInst()->GetNumFrames(); + const int num_voxels = ImageCore::GetInst()->GetNumVoxels(); + const std::vector& flg4d = ImageCore::GetInst()->m_flg4d; + std::vector& mask4d = ImageCore::GetInst()->m_mask4d; + +#pragma omp parallel for + for (int f = 0; f < num_frames; ++f) + { + byte* flg3d = flg4d[f]; + byte* msk3d = mask4d[f]; + for (int i = 0; i < num_voxels; ++i) + { + if (msk3d[i] == maskID)flg3d[i] = 255; + } + } + ImageCore::GetInst()->mask_storeCurrentForeGround(); + + //②編集して塗った領域をmnaskIDへマージする。 + const auto& maskdata = ImageCore::GetInst()->GetMaskData(); + ImageCore::GetInst()->SelectedMsk_marge(static_cast(maskdata.size())-2); + formVisMask_updateList(); + + ModeCore::GetInst()->ModeSwitch(MODE_VIS_MASK); + formMain_RedrawMainPanel(); +} + + + +void ModeRefPixPaint::cancelBtnClick() +{ + if (ShowMsgDlgYesNo("現在の編集結果を破棄してよいですか\nDo you want to cancel current Editing?", "cancel?")) + { + m_b_modified = false; + ModeCore::GetInst()->ModeSwitch(MODE_VIS_NORMAL); + formMain_RedrawMainPanel(); + } +} diff --git a/RoiPainter4D/RoiPainter4D/Mode/ModeRefPixPaint.h b/RoiPainter4D/RoiPainter4D/Mode/ModeRefPixPaint.h new file mode 100644 index 0000000..f6bc0e6 --- /dev/null +++ b/RoiPainter4D/RoiPainter4D/Mode/ModeRefPixPaint.h @@ -0,0 +1,70 @@ +#ifndef MODE_MODREFPIXPAINT_H_ +#define MODE_MODREFPIXPAINT_H_ +#pragma unmanaged + +#include "ModeInterface.h" + +//----------------------------------------------- +// (*) User Interface +// L drag : draw trim stroke +// R click : cancel drawn stroke +// +// (*) vol_flg +// 0 : not the target +// 1 : backgroupd +// 255 : foreground (highlighted in Green) +//----------------------------------------------- + +class ModeRefPixPaint : public ModeInterface +{ + //lasso + CRSSEC_ID m_trgt_crssecid; + bool m_b_drawlasso; + std::vector m_lasso; + std::vector m_lasso_previous; + + bool m_b_modified; + bool m_b_draw_crssec; + + byte* m_msk3D_pre; + int m_msk3D_pre_fi; + + ModeRefPixPaint(); +public: + ~ModeRefPixPaint(); + static ModeRefPixPaint* GetInst() { static ModeRefPixPaint p; return &p; } + + // overload functions --------------------------------------------- + MODE_ID GetModeID() { return MODE_REF_STRKTRIM; } + void LBtnUp (const EVec2i& p, OglForCLI* ogl); + void RBtnUp (const EVec2i& p, OglForCLI* ogl); + void MBtnUp (const EVec2i& p, OglForCLI* ogl); + void LBtnDown (const EVec2i& p, OglForCLI* ogl); + void RBtnDown (const EVec2i& p, OglForCLI* ogl); + void MBtnDown (const EVec2i& p, OglForCLI* ogl); + void LBtnDclk (const EVec2i& p, OglForCLI* ogl); + void RBtnDclk (const EVec2i& p, OglForCLI* ogl); + void MBtnDclk (const EVec2i& p, OglForCLI* ogl); + void MouseMove (const EVec2i& p, OglForCLI* ogl); + void MouseWheel(const EVec2i& p, short zDelta, OglForCLI* ogl); + void KeyDown (int nChar); + void KeyUp (int nChar); + bool CanEndMode(); + void StartMode(); + void DrawScene(const EVec3f& cam_pos, const EVec3f& cam_center); + void finishTrim(); + void cancelBtnClick(); + //----------------------------------------------------------------- + +private: + void t_addPixsInsideLasso + ( + const CRSSEC_ID id, + const EVec3i reso, + const EVec3f pitch, + const std::vector& lasso_stroke + ); + void RunRegionGrow3D_OneFrame(const short minv, const short maxv, const EVec3f pos); +}; + +#endif \ No newline at end of file diff --git a/RoiPainter4D/RoiPainter4D/Mode/ModeRefStrokeTrim.cpp b/RoiPainter4D/RoiPainter4D/Mode/ModeRefStrokeTrim.cpp index ab7826e..832f4df 100644 --- a/RoiPainter4D/RoiPainter4D/Mode/ModeRefStrokeTrim.cpp +++ b/RoiPainter4D/RoiPainter4D/Mode/ModeRefStrokeTrim.cpp @@ -260,7 +260,7 @@ void ModeRefStrokeTrim::DrawScene(const EVec3f &cam_pos, const EVec3f &cam_cnt) ImageCore::GetInst()->BindAllVolumes(); if (m_b_draw_crssec) - DrawCrossSectionsVisFore(!IsSKeyOn()); + DrawCrossSectionsVisFore(!IsDKeyOn()); if (m_b_draw_cutstroke) DrawPolyLine( EVec3f(1,1,0), 3, m_stroke3d, false); diff --git a/RoiPainter4D/RoiPainter4D/ModeCore.cpp b/RoiPainter4D/RoiPainter4D/ModeCore.cpp index eb5c1eb..2f6f366 100644 --- a/RoiPainter4D/RoiPainter4D/ModeCore.cpp +++ b/RoiPainter4D/RoiPainter4D/ModeCore.cpp @@ -15,6 +15,7 @@ #include "Mode/ModeSegStrokeFfd.h" #include "Mode/ModePlaceCPs.h" #include "Mode/ModeRefCurveDeform.h" +#include "Mode/ModeRefPixPaint.h" #pragma managed #include "FormVisMask.h" @@ -32,6 +33,7 @@ #include "FormSegStrokeFfd.h" #include "FormPlaceCPs.h" #include "FormRefCurveDeform.h" +#include "FormRefPixPaint.h" #pragma unmanaged using namespace RoiPainter4D; @@ -75,6 +77,7 @@ void ModeCore::ModeSwitch(MODE_ID m) else if (m == MODE_SEG_BRONCHI ) m_mode = ModeSegBronchi::GetInst(); else if (m == MODE_PLC_CPS) m_mode = ModePlaceCPs ::GetInst(); else if (m == MODE_REF_CURVEDEFORM) m_mode = ModeRefCurveDeform::GetInst(); + else if (m == MODE_REF_PIXPAINT) m_mode = ModeRefPixPaint::GetInst(); else m_mode = ModeVizNormal ::GetInst(); @@ -94,6 +97,7 @@ void ModeCore::ModeSwitch(MODE_ID m) FormSegStrokeFfd_Hide(); FormPlaceCPs_Hide(); FormRefCurveDeform_Hide(); + formRefPixPaint_Hide(); m_mode->StartMode(); } diff --git a/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj b/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj index 5ebb27a..eea1d9c 100644 --- a/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj +++ b/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj @@ -170,6 +170,7 @@ + @@ -195,6 +196,7 @@ + @@ -242,6 +244,9 @@ CppForm + + CppForm + CppForm @@ -299,6 +304,7 @@ + @@ -327,6 +333,7 @@ FormPlaceCPs.h + FormRefStrokeTrim.h diff --git a/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj.filters b/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj.filters index 7a8ff8c..7f1c6cd 100644 --- a/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj.filters +++ b/RoiPainter4D/RoiPainter4D/RoiPainter4D.vcxproj.filters @@ -186,6 +186,12 @@ COMMON + + ソース ファイル + + + Mode + @@ -374,6 +380,12 @@ COMMON + + ヘッダー ファイル + + + Mode + @@ -388,9 +400,6 @@ リソース ファイル - - リソース ファイル - リソース ファイル @@ -430,6 +439,9 @@ ヘッダー ファイル + + リソース ファイル +