<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Hi all Users & Developers,<div><br></div><div><br></div><div>I' m fresh user. I'm begining my adventure with IGSTK...</div>
<div>I 'm just working with example LandmarkRegistration1(Sandbox). </div><div>I have to do a DLL & wrapper with this example.</div><div>I have already made a method with this transformation but I have a problem with <font color="#ff0000"><b>returned type</b>.</font></div>
<div>I want to return for example 1 element (point) after transformation .</div><div>Could You help me please ?</div><div>I would appreciate for any help .</div><div><br></div><div><br></div><div>Code : </div><div><br></div>
<div><div>extern "C"</div><div>{</div><div><br></div><div><span style="white-space: pre-wrap; "> </span></div><div><b><font color="#ff0000"> __declspec(dllexport) double RegistrationDLL(double tab[30])</font></b></div>
<div><span style="white-space: pre-wrap; "> </span> {</div><div><br></div><div>igstk::RealTimeClock::Initialize();</div><div><br></div><div><br></div><div>// BeginCodeSnippet</div><div> typedef igstk::Object::LoggerType LoggerType;</div>
<div> typedef itk::StdStreamLogOutput LogOutputType;</div><div> </div><div> typedef igstk::Landmark3DRegistration</div><div> Landmark3DRegistrationType;</div><div> typedef igstk::Landmark3DRegistration::LandmarkPointContainerType</div>
<div> LandmarkPointContainerType;</div><div> typedef igstk::Landmark3DRegistration::LandmarkImagePointType </div><div> LandmarkImagePointType;</div><div> typedef igstk::Landmark3DRegistration::LandmarkTrackerPointType</div>
<div> LandmarkTrackerPointType;</div><div> typedef Landmark3DRegistrationType::TransformType::OutputVectorType </div><div> OutputVectorType;</div><div> typedef igstk::Transform TransformType;</div>
<div>// EndCodeSnippet</div><div><br></div><div><br></div><div>// BeginLatex</div><div>// </div><div>// Then, the registration component is instantiated as follows:</div><div>// </div><div>// EndLatex</div><div><br></div>
<div>// BeginCodeSnippet</div><div> Landmark3DRegistrationType::Pointer landmarkRegister = </div><div> Landmark3DRegistrationType::New();</div><div>// EndCodeSnippet</div><div> </div>
<div><br></div><div>// BeginLatex</div><div>// </div><div>// Next, the landmark containers that hold the landmark image and tracker </div><div>// coordinates are instantiated:</div><div>//</div><div>// EndLatex</div><div>
<br></div><div>// BeginCodeSnippet</div><div> LandmarkPointContainerType imagePointContainer;</div><div> LandmarkPointContainerType trackerPointContainer;</div><div>// EndCodeSnippet</div><div><br></div><div><br></div>
<div> LandmarkImagePointType imagePoint;</div><div> LandmarkTrackerPointType trackerPoint;</div><div><br></div><div>// BeginLatex</div><div>// </div><div>// Then, error event callback objects are instantiated and added to the observer</div>
<div>// list of the registration component, as follows:</div><div>//</div><div>// EndLatex</div><div><br></div><div>// BeginCodeSnippet</div><div> Landmark3DRegistrationInvalidRequestCallback::Pointer </div><div> lrcb = Landmark3DRegistrationInvalidRequestCallback::New();</div>
<div> </div><div> typedef igstk::InvalidRequestErrorEvent InvalidRequestEvent;</div><div><br></div><div> landmarkRegister->AddObserver( InvalidRequestEvent(), lrcb );</div><div><br></div><div> Landmark3DRegistrationErrorCallback::Pointer ecb = </div>
<div> Landmark3DRegistrationErrorCallback::New();</div><div> typedef igstk::Landmark3DRegistration::TransformComputationFailureEvent </div><div> ComputationFailureEvent;</div>
<div> landmarkRegister->AddObserver( ComputationFailureEvent(), ecb );</div><div><br></div><div>// EndCodeSnippet</div><div><br></div><div>// BeginLatex</div><div>// </div><div>// A logger can then be connected to the registration component for </div>
<div>// debugging purpose, as follows:</div><div>//</div><div>// EndLatex</div><div><br></div><div><br></div><div>// BeginCodeSnippet </div><div> LoggerType::Pointer logger = LoggerType::New();</div><div> LogOutputType::Pointer logOutput = LogOutputType::New();</div>
<div> logOutput->SetStream( std::cout );</div><div> logger->AddLogOutput( logOutput );</div><div> logger->SetPriorityLevel( LoggerType::DEBUG );</div><div> landmarkRegister->SetLogger( logger );</div><div>
// EndCodeSnippet</div><div> </div><div><br></div><div>// BeginLatex</div><div>//</div><div>// Next, landmark points are added to the image and tracker containers. The</div><div>// state machine of this registration component is designed so that the image</div>
<div>// and tracker coordinates that correspond to each landmark are added</div><div>// consecutively. This scheme prevents the mismatch in landmark correspondence</div><div>// that could occur when all landmarks image coordinates are recorded first and</div>
<div>// followed by the tracker coordinates. This design choice is consistent with</div><div>// the ``safety by design'' philosophy of IGSTK. The commands are as follows:</div><div>//</div><div>//EndLatex </div><div>
<br></div><div>// BeginCodeSnippet</div><div> // Add entry</div><div> imagePoint[0] = tab[0];</div><div> imagePoint[1] = tab[1];</div><div> imagePoint[2] = tab[2];</div><div> imagePointContainer.push_back(imagePoint);</div>
<div> landmarkRegister->RequestAddImageLandmarkPoint(imagePoint);</div><div><br></div><div> trackerPoint[0] = tab[3];</div><div> trackerPoint[1] = tab[4];</div><div> trackerPoint[2] = tab[5];</div><div> trackerPointContainer.push_back(trackerPoint);</div>
<div> landmarkRegister->RequestAddTrackerLandmarkPoint(trackerPoint);</div><div><br></div><div> // Add 1st landmark</div><div> imagePoint[0] = tab[6];</div><div> imagePoint[1] = tab[7];</div><div> imagePoint[2] = tab[8];</div>
<div> imagePointContainer.push_back(imagePoint);</div><div> landmarkRegister->RequestAddImageLandmarkPoint(imagePoint);</div><div> </div><div> trackerPoint[0] = tab[9];</div><div> trackerPoint[1] = tab[10];</div>
<div> trackerPoint[2] = tab[11];</div><div> trackerPointContainer.push_back(trackerPoint);</div><div> landmarkRegister->RequestAddTrackerLandmarkPoint(trackerPoint);</div><div><br></div><div> // Add 2nd landmark</div>
<div> imagePoint[0] = tab[12];</div><div> imagePoint[1] = tab[13];</div><div> imagePoint[2] = tab[14];</div><div> imagePointContainer.push_back(imagePoint);</div><div> landmarkRegister->RequestAddImageLandmarkPoint(imagePoint);</div>
<div><br></div><div> trackerPoint[0] = tab[15];</div><div> trackerPoint[1] = tab[16];</div><div> trackerPoint[2] = tab[17];</div><div> trackerPointContainer.push_back(trackerPoint);</div><div> landmarkRegister->RequestAddTrackerLandmarkPoint(trackerPoint);</div>
<div><br></div><div> // EndCodeSnippet</div><div><br></div><div> // BeginLatex</div><div> // </div><div> // More landmarks can be added for the transform computation. </div><div> // </div><div> // EndLatex</div><div>
<br></div><div> // Add 3n landmark</div><div> imagePoint[0] = tab[18];</div><div> imagePoint[1] = tab[19];</div><div> imagePoint[2] = tab[20];</div><div> imagePointContainer.push_back(imagePoint);</div><div> landmarkRegister->RequestAddImageLandmarkPoint(imagePoint);</div>
<div><br></div><div> trackerPoint[0] = tab[21];</div><div> trackerPoint[1] = tab[22];</div><div> trackerPoint[2] = tab[23];</div><div> trackerPointContainer.push_back(trackerPoint);</div><div> landmarkRegister->RequestAddTrackerLandmarkPoint(trackerPoint);</div>
<div><br></div><div> // Add target</div><div> imagePoint[0] = tab[24];</div><div> imagePoint[1] = tab[25];</div><div> imagePoint[2] = tab[26];</div><div> imagePointContainer.push_back(imagePoint);</div><div> landmarkRegister->RequestAddImageLandmarkPoint(imagePoint);</div>
<div><br></div><div> trackerPoint[0] = tab[27];</div><div> trackerPoint[1] = tab[28];</div><div> trackerPoint[2] = tab[29];</div><div> trackerPointContainer.push_back(trackerPoint);</div><div> landmarkRegister->RequestAddTrackerLandmarkPoint(trackerPoint);</div>
<div><br></div><div> // BeginLatex</div><div> // </div><div> // After all landmark coordinates are added, the transform computation is </div><div> // requested as follows:</div><div> // </div><div> // EndLatex</div>
<div><br></div><div> // Calculate transform</div><div><br></div><div> // BeginCodeSnippet</div><div> landmarkRegister->RequestComputeTransform();</div><div> // EndCodeSnippet</div><div> </div><div> typedef itk::VersorRigid3DTransform<double> VersorRigid3DTransformType;</div>
<div> typedef VersorRigid3DTransformType::ParametersType ParametersType;</div><div><br></div><div><br></div><div><br></div><div><br></div><div> TransformType transform;</div><div> ParametersType parameters(6);</div>
<div><br></div><div> // BeginLatex</div><div> // </div><div> // To access the transform parameters, a GetTransform callback is instantiated</div><div> // to observe the transform event, as follows: </div><div> // </div>
<div> // EndLatex</div><div><br></div><div> // BeginCodeSnippet</div><div> Landmark3DRegistrationGetTransformCallback::Pointer lrtcb =</div><div> Landmark3DRegistrationGetTransformCallback::New();</div><div><br></div>
<div> landmarkRegister->AddObserver( </div><div> igstk::CoordinateSystemTransformToEvent(), lrtcb );</div><div> //EndCodeSnippet</div><div><br></div><div><br></div><div> // BeginLatex</div><div> //</div><div> // To request that the registration component throw an event loaded with </div>
<div> // transform parameters, a \code{RequestGetTransform} function is invoked as </div><div> // follows:</div><div> // </div><div> // EndLatex</div><div><br></div><div> // BeginCodeSnippet</div><div> landmarkRegister->RequestGetTransformFromTrackerToImage();</div>
<div> std::cout<<" "<<std::endl;</div><div> std::cout << "Transform " << transform << std::endl;</div><div><br></div><div> // EndCodeSnippet</div><div><br></div><div><br>
</div><div><br></div><div><br></div><div><br></div><div><b><font color="#ff0000"> // return tab[4]; // ????? </font></b></div><div><b><font color="#ff0000"><br></font></b></div><div><b><font color="#ff0000">return ... ?? </font></b></div>
<div>}</div><div><br></div><div>}</div></div><div><br></div><div>Best, </div><div>Agata </div></span>