<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Thanks for this reply, but part of it is not what I was looking
      for. In my understanding, the solution you suggested allows to
      multiply a VariableSizeMatrix with a Vector, and then store the
      result into a VariableLenghtVector. But my input is also a
      VariableLengthVector, not a Vector. <br>
    </p>
    <p>So let me be clearer: I want to multiply a VariableSizeMatrix
      with a VariableLengthVector. Is there a way to extract from this
      VariableLengthVector something that can be multiplied with
      VariableSizeMatrix.GetVnlMatrix() ? Maybe I should copy my
      VariableLengthVector into a vnl_vector ?</p>
    <p>I do not know the size of that VariableLengthVector at compile
      time, so I cannot create an itk::Vector of the correct size.<br>
    </p>
    Best,<br>
    Cyril<br>
    <br>
    <div class="moz-cite-prefix">On 09/19/2016 06:12 PM, Francois Budin
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAHwLD2X7J_-GuS1bh+t+=7ZsqnN8R6NpXE4uhvcZUSxrv5Cd4A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>Hello Cyril,<br>
                          <br>
                        </div>
                        For the matrix conversion, you can use
                        itk::Matrix::GetVnlMatrix() to extract the
                        matrix from the itk::Matrix object, and use
                        assign that vnl matrix to your
                        itk::VariableLengthVector using operator=(const
                        vnl_matrix< T > &matrix).<br>
                        <br>
                      </div>
                    </div>
                    itk::Matrix<float,3,3> mat;<br>
                  </div>
                  itk::VariableSizeMatrix<float> v_mat;<br>
                </div>
                v_mat = mat.GetVnlMatrix();<br>
                <br>
              </div>
              For the vectors, you could get access to the data from
              itk::Vector and pass the pointer to the data to your
              itk::VariableLengthVector.<br>
            </div>
            itk::Vector<float> vec;<br>
            itk::VariableLengthVector<float> v_vec;<br>
            v_vec.SetSize(3);<br>
            v_vec.SetData(vec.GetDataPointer(),false);<br>
          </div>
        </div>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div><br>
                    <div>
                      <div>Be careful with the memory management for the
                        vector as the data is still managed by the
                        itk::Vector in this example, so the data will be
                        destroyed if the vector is destroyed (if you go
                        out of scope).<br>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Sep 19, 2016 at 11:05 AM, Cyril
          Mory <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:cyril.mory@creatis.insa-lyon.fr"
              target="_blank">cyril.mory@creatis.insa-lyon.fr</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi ITK
            users,<br>
            <br>
            I have some working ITK code with itk::Matrix by itk::Vector
            multiplications, and I need to change to
            itk::VariableSizeMatrix and itk::VariableLengthVector.<br>
            <br>
            Simply writing<br>
            <br>
            "myResultVector = myMatrix * myInputVector"<br>
            <br>
            works with itk::Matrix and itk::Vector objects, but not with
            their VariableSize/Length counterparts. Is there a way to do
            it, other than writing the matrix by vector multiplication
            for-loops myself ?<br>
            <br>
            Regards,<br>
            <br>
            Cyril<br>
            <br>
            ______________________________<wbr>_______<br>
            Powered by <a moz-do-not-send="true"
              href="http://www.kitware.com" rel="noreferrer"
              target="_blank">www.kitware.com</a><br>
            <br>
            Visit other Kitware open-source projects at<br>
            <a moz-do-not-send="true"
              href="http://www.kitware.com/opensource/opensource.html"
              rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
            <br>
            Kitware offers ITK Training Courses, for more information
            visit:<br>
            <a moz-do-not-send="true"
              href="http://www.kitware.com/products/protraining.php"
              rel="noreferrer" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br>
            <br>
            Please keep messages on-topic and check the ITK FAQ at:<br>
            <a moz-do-not-send="true"
              href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer"
              target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br>
            <br>
            Follow this link to subscribe/unsubscribe:<br>
            <a moz-do-not-send="true"
              href="http://public.kitware.com/mailman/listinfo/insight-users"
              rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>