<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Vahid,</p>
    <p>Welcome to RTK :)</p>
    Indeed, there are several iterative methods already implemented in
    RTK, but none of the filters allows you to easily extract the
    gradient of the least squares function there are minimizing. <br>
    If you need to minimize the classical non-regularized tomographic
    cost function, ie || R f - p ||², with R the forward projection
    operator, f the volume you are looking for, and p the measured
    projections, my best advice would be to copy some part of the
    pipeline of rtkSARTConeBeamReconstructionFilter to get the job done,
    ie the following part (copy-paste this into webgraphviz.com)<br>
    <br>
    digraph SARTConeBeamReconstructionFilter {<br>
    <br>
    Input0 [ label="Input 0 (Volume)"];<br>
    Input0 [shape=Mdiamond];<br>
    Input1 [label="Input 1 (Projections)"];<br>
    Input1 [shape=Mdiamond];<br>
    <br>
    node [shape=box];<br>
    ForwardProject [ label="rtk::ForwardProjectionImageFilter" URL="\ref
    rtk::ForwardProjectionImageFilter"];<br>
    Extract [ label="itk::ExtractImageFilter" URL="\ref
    itk::ExtractImageFilter"];<br>
    MultiplyByZero [ label="itk::MultiplyImageFilter (by zero)"
    URL="\ref itk::MultiplyImageFilter"];<br>
    AfterExtract [label="", fixedsize="false", width=0, height=0,
    shape=none];<br>
    Subtract [ label="itk::SubtractImageFilter" URL="\ref
    itk::SubtractImageFilter"];<br>
    MultiplyByLambda [ label="itk::MultiplyImageFilter (by lambda)"
    URL="\ref itk::MultiplyImageFilter"];<br>
    Divide [ label="itk::DivideOrZeroOutImageFilter" URL="\ref
    itk::DivideOrZeroOutImageFilter"];<br>
    GatingWeight [ label="itk::MultiplyImageFilter (by gating weight)"
    URL="\ref itk::MultiplyImageFilter", style=dashed];<br>
    Displaced [ label="rtk::DisplacedDetectorImageFilter" URL="\ref
    rtk::DisplacedDetectorImageFilter"];<br>
    ConstantProjectionStack [ label="rtk::ConstantImageSource" URL="\ref
    rtk::ConstantImageSource"];<br>
    ExtractConstantProjection [ label="itk::ExtractImageFilter"
    URL="\ref itk::ExtractImageFilter"];<br>
    RayBox [ label="rtk::RayBoxIntersectionImageFilter" URL="\ref
    rtk::RayBoxIntersectionImageFilter"];<br>
    ConstantVolume [ label="rtk::ConstantImageSource" URL="\ref
    rtk::ConstantImageSource"];<br>
    BackProjection [ label="rtk::BackProjectionImageFilter" URL="\ref
    rtk::BackProjectionImageFilter"];<br>
    OutofInput0 [label="", fixedsize="false", width=0, height=0,
    shape=none];<br>
    OutofBP [label="", fixedsize="false", width=0, height=0,
    shape=none];<br>
    BeforeBP [label="", fixedsize="false", width=0, height=0,
    shape=none];<br>
    BeforeAdd [label="", fixedsize="false", width=0, height=0,
    shape=none];<br>
    Input0 -> OutofInput0 [arrowhead=none];<br>
    OutofInput0 -> ForwardProject;<br>
    ConstantVolume -> BeforeBP [arrowhead=none];<br>
    BeforeBP -> BackProjection;<br>
    Extract -> AfterExtract[arrowhead=none];<br>
    AfterExtract -> MultiplyByZero;<br>
    AfterExtract -> Subtract;<br>
    MultiplyByZero -> ForwardProject;<br>
    Input1 -> Extract;<br>
    ForwardProject -> Subtract;<br>
    Subtract -> MultiplyByLambda;<br>
    MultiplyByLambda -> Divide;<br>
    Divide -> GatingWeight;<br>
    GatingWeight -> Displaced;<br>
    ConstantProjectionStack -> ExtractConstantProjection;<br>
    ExtractConstantProjection -> RayBox;<br>
    RayBox -> Divide;<br>
    Displaced -> BackProjection;<br>
    BackProjection -> OutofBP [arrowhead=none];<br>
    }<br>
    <br>
    As you can see, it is a very large part of the SART reconstruction
    filter, so yoiu might be better off just copying the whole
    SARTConeBeamReconstructionFilter and modifying it. <br>
    <br>
    Of course, you could also look into ITK's cost function class, and
    see if one of the classes inherited from it suits your needs,
    implement your cost function this way, and use ITK's off-the-shelf
    solvers to minimize it. See the inheritance diagram in
    <a class="moz-txt-link-freetext" href="https://itk.org/Doxygen/html/classitk_1_1CostFunctionTemplate.html">https://itk.org/Doxygen/html/classitk_1_1CostFunctionTemplate.html</a>
    if you want to try this approach.<br>
    <br>
    Best regards,<br>
    Cyril<br>
    <br>
    <div class="moz-cite-prefix">On 11/01/2016 05:50 PM, vahid ettehadi
      via Rtk-users wrote:<br>
    </div>
    <blockquote
      cite="mid:1400014065.1872614.1478019012480@mail.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff;
        font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
        Lucida Grande, sans-serif;font-size:14px">
        <div id="yui_3_16_0_ym19_1_1478018323282_15982">Hello RTK users
          and developers,</div>
        <div id="yui_3_16_0_ym19_1_1478018323282_15982"><br>
        </div>
        <div id="yui_3_16_0_ym19_1_1478018323282_15982">I already
          implemented the RTK and reconstructed some images with the FDK
          algorithm implemented in RTK. It works well. Thanks to RTK
          developers.<br>
        </div>
        <div id="yui_3_16_0_ym19_1_1478018323282_17709" dir="ltr">Now, I
          am trying to develop a model-based image reconstruction for
          our cone-beam micro-CT. I see already that some iterative
          algorithms like ART and its modifications and
          conjugate-gradient (CG) method are implemented in the RTK. I
          want to develop a model-based reconstruction through the
          Newton/quasi-Newton optimizations methods. I was wondering is
          it possible to extract the gradient of least square function
          from implemented algorithms like CG module? Any recommendation
          will be appreciated. </div>
        <div id="yui_3_16_0_ym19_1_1478018323282_17709" dir="ltr"><br>
        </div>
        <div id="yui_3_16_0_ym19_1_1478018323282_17709" dir="ltr">Best
          Regards,</div>
        <div id="yui_3_16_0_ym19_1_1478018323282_17709" dir="ltr">Vahid</div>
        <div dir="ltr" id="yui_3_16_0_ym19_1_1478018323282_17710"><br
            id="yui_3_16_0_ym19_1_1478018323282_17711">
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Rtk-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rtk-users@public.kitware.com">Rtk-users@public.kitware.com</a>
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/rtk-users">http://public.kitware.com/mailman/listinfo/rtk-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>