버튼을 Click 한 이벤트를 ViewModel 의 Command 에 binding 하고, 이때 CommandParameter를 전달하는 방법이다. 이 때 전달하는 Parameter는 string 으로 입력을 하므로, 다른 타입으로 변환하여 전달하고 싶으면 Coverter를 정의해야한다. 간단하게 string to double converter를 구현하고 이를 CommandParameter의 내부 converter 속성에 conveter를 입력한다. 1, 2의 tag의 경우에는 CommandParameter는 string 으로만 입력할 수 있으므로, 매개변수를 string 또는 object 를 갖는 command 와 연결할 수 있다. 다른 것은 전달되는 타입만 다를뿐 값은 동일하다. 3번은 Command..
개별 view를 이용한 dialog Creating a dialog service in an MVVM application is a great way to show different types of dialogs (e.g., messaging, prompts, information windows) without directly depending on specific views from the ViewModel. This allows you to maintain separation of concerns and avoid tightly coupling the ViewModel to the UI. Here's a step-by-step guide on building a dialog service: 1. **..
using OpenCvSharp; using System; using System.Collections.Generic; class CameraCalibration { static void Main() { TermCriteria criteria = new TermCriteria(CriteriaTypes.Eps | CriteriaTypes.MaxIter, 30, 0.001); Size patternSize = new Size(7, 6); double squareSize = 20.0; // Assuming millimeters List objectPoints = new List(); List imagePoints = new List(); Point3f[] objp = new Point3f[patternSize..
1. 개요 WPF 을 개발하면 Xaml Designer 를 통해서 윈도우의 디자인을 구성하게 됩니다. 이때 프로그램 실행에는 문제가 없으나 개발을 진행하면서 어느 순간 Designer가 에러가 발생하여 Control을 제대로 렌더링하지 못하게 되는 경우가 있습니다. 일반 Runtime 에서의 디버깅은 Debug 모드에서 충분히 할 수 있지만, Desinger에서 발생하는 문제같은 경우에는 디버깅하기가 쉽지 않습니다. 이를 해결하는 방법을 알아보도록 합니다. 해당 내용은 Visual Studio 2022를 기준으로 합니다. 2. Designer 프로세스 알아보기 WPF 의 Designer는 어떻게 동작하는 걸까요? WPF Designer도 Application 실행과 비슷하게 내부적으로 'Microsoft..
1. 개요 VTK 에서 지원하는 파일 타입을 알아본다. 2. 지원 파일 File Extension Description Data Types .vtk Legacy VTK format. Stores a wide range of data types in either ASCII or binary format. Structured and unstructured grids, polygons, images .vti VTK XML Image Data format. Stores structured points or image datasets. Structured points, images .vtp VTK XML PolyData format. Stores polygonal data. Polygons .vtu VTK XML..
1. 개요 입력된 원본 이미지의 Painting 작업을 위해서는 Mask 용 이미지데이터가 필요하다. 이를 위해 원본 이미지에 맞는 Painting Mask 용 이미지 데이터를 생성하고 임의의 영역에 대한 초기값을 입력하는 것을 알아본다. 2. Painting Source 만들기 Masking 용으로 사용되는 이미지는 Compoenent가 1이며 unsigned char 타입의 scalar type을 갖는다. 원본이미지의 Spacing, Dimension, Origin만 참고하여 새로운 이미지 데이터를 만들면 된다. public void CreatePaintingSourceImageData() { paintData = vtkImageData.New(); paintData.SetOrigin(0, 0, 0)..
1. 개요 Pipeline에서 Modified 가 발생할 경우 이루어지는 내부 workflow를 분석한다. 2. 연결된 Pipeline 구성도 3. Pipeline 동작 분석 Interactor 이벤트를 통해 Mask의 픽셀을 변경하고 Modified()를 호출하면 내부적으로 RenderWindow의 Render를 실행하는데 이때 Modified 가 있는 Filter가 있으므로 다음과 같은 순서로 Pipeline이 동작한다. Mask:vtkImageCanvasSource2D에서 Modified를 호출하고 Rendering을 하면 Modified 된 Pipeline 에 영향을 받는 하위 Pipeline filter들은 Progress Start -> Progress[n] -> Progress End 순으로..
1. 개요 vtkImageMask Filter의 기본적인 사용 방법을 알아본다. 2. vtkImageMaskFilter Mask filter는 source image 와 mask 이미지간의 중첩되는 픽셀만을 최종 결과 값으로 출력하는 filter이다. 주의할 점은 source image의 채널은 상관없지만 mask image는 component 가 1인 1채널 이미지여야 한다. Masking 은 단순히 0이면 원본 이미지가 통과하지 못하고 0이 아닌 값이면 통과하여 원본이미지 픽셀 값이 그대로 표현된다. Mask filter에는 NotMaskOn을 설정함으로써 Mask를 invser로 적용할 수도 있다. 3. 코드 및 Pipeline 구성 구현한 테스트 코드의 중요 부분과 pipeline의 연결도이다. ..
1. 개요 Array 간의 데이터 타입 변환을 수행하고 성능을 비교한다. 2. 비교할 구현 코드 For loop Linq Select Array.ConvertAll [Test] public void TestConvertPerf() { PerfBenchmark bench = new PerfBenchmark("Convert Benchmark"); var intArr = RandomUtils.GenerateInt(500000); int repSize = 1000; bench.Start(); for (int i = 0; i < repSize; i++) { ToDoubleArray(intArr); bench.SaveCheckpoint(); } bench.Stop(); Console.WriteLine($"Avg, ..
1. 개요 Target이 되는 Actor 을 지정하고 이를 Interaction 에 따라 변경되는 위치를 추적하여 따라다니는 Tracking 2D Actor를 구현한다. 2. Tracking Image Actor2D vtkImageMapper 에 할당된 이미지를 vtkActor2D 에 입력하고 Tracking을 위한 Interaction event 를 입력한다. public void TestTrackingImageActor2D() { EnableDrawAxes = true; AxesLength = 15; var filePath = Path.Combine(DirPath, "reconnect.png"); var imgData = VtkImageUtils.ReadImageData(filePath); vtkRe..