[Insight-developers] Quick Q about TCL Wrapping and itk::Image

kent williams norman-k-williams at uiowa.edu
Mon Jun 29 13:34:10 EDT 2009


I need to add a TCL command to allow ITK images to be passed to a KWWidgets
application object.  What I gather is I need to install it with
Tcl_CreatObjCommand.  I understand how that works, the question is how to
extract an itk::Image pointer from the argument vector.  My first crack at
it (and I've not been able to test it quite yet) is this:

int
SetITKImage(ClientData clientData,
            Tcl_Interp *interp,
            int objc,
            Tcl_Obj *const obv[])
{
  if(objc < 1 || objc > 1)
    {
    return TCL_FAILURE;
    }
  itk::ImageBase<3>::Pointer im =
  reinterpret_cast<itk::ImageBase<3> *>(obv[0]->internalRep.otherValuePtr);
  myApp->SetImageBase(im);
  return TCL_OK;
}

Is this what is required?  Are there other things I need to worry about?



More information about the Insight-developers mailing list