<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-forward-container"><br>
      <br>
      -------- Forwarded Message --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
            </th>
            <td>Re: [Paraview] Fwd: Image Doesn't load correctly</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
            <td>Tue, 05 May 2015 09:14:06 -0700</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
            <td>Burlen Loring <a class="moz-txt-link-rfc2396E" href="mailto:bloring@lbl.gov"><bloring@lbl.gov></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
            <td>Dean, Kevin <a class="moz-txt-link-rfc2396E" href="mailto:kevin.dean@decisionsciencescorp.com"><kevin.dean@decisionsciencescorp.com></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      ParaView should set it after it determines if the reader can read
      it. Did you also implement CanReadFile? Maybe the problem is in
      that function.<br>
      <br>
      <div class="moz-cite-prefix">On 05/05/2015 09:09 AM, Dean, Kevin
        wrote:<br>
      </div>
      <blockquote
cite="mid:CAFvyM3T0-EBWY1CB2k4ognrpP3tHZsV687Aw+XNrtb0iaEY-Vw@mail.gmail.com"
        type="cite">
        <div dir="ltr"><br>
          <div class="gmail_quote">---------- Forwarded message
            ----------<br>
            From: <b class="gmail_sendername">Dean, Kevin</b> <span
              dir="ltr"><<a moz-do-not-send="true"
                href="mailto:kevin.dean@decisionsciencescorp.com">kevin.dean@decisionsciencescorp.com</a>></span><br>
            Date: Mon, May 4, 2015 at 5:10 PM<br>
            Subject: Re: [Paraview] Image Doesn't load correctly<br>
            To: Burlen Loring <<a moz-do-not-send="true"
              href="mailto:burlen.loring@gmail.com">burlen.loring@gmail.com</a>><br>
            <br>
            <br>
            <div dir="ltr">
              <div>
                <div>awesome, thanks, that did it.<br>
                  <br>
                  One more question. Is there a way to debug the
                  FileName aspect of the reader. I can't figure out how
                  it's supposed to get set. The only way I can get the
                  image to show is by hard <br>
                  coding it within the RequestData() function.<br>
                  <br>
                </div>
                Thanks Again<br>
                <br>
              </div>
              Kevin E. Dean<br>
            </div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Mon, May 4, 2015 at 11:33
                    AM, Burlen Loring <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:burlen.loring@gmail.com"
                        target="_blank">burlen.loring@gmail.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000"> Hi Kevin.<br>
                        <br>
                        Your RequestInformation looks a little bare.
                        Unless things have changed recently, you might
                        need to set WHOLE_EXTENT, ORIGIN, SPACING,
                        CAN_PRODUCE_SUB_EXTENT keys there. and if you
                        support parallel IO honor the requested extent
                        in RequestData.<br>
                        <br>
                        Burlen
                        <div>
                          <div><br>
                            <br>
                            <div>On 05/04/2015 09:52 AM, Dean, Kevin
                              wrote:<br>
                            </div>
                          </div>
                        </div>
                        <blockquote type="cite">
                          <div>
                            <div>
                              <div dir="ltr">
                                <div>So I am still having a few issues
                                  with the reader. I have checked the
                                  output from the information Panel. And
                                  it seems as if all the information is
                                  the same. So maybe the data is getting
                                  deleted somehow (I'm not sure...., but
                                  here is a snippet of my code);<br>
                                  <br>
                                  int
                                  vtkPVPROTOImageReader::RequestInformation
                                  (<br>
                                     vtkInformation*,<br>
                                     vtkInformationVector**,<br>
                                     vtkInformationVector* outputVector)<br>
                                  {<br>
                                     vtkInformation* outInfo =
                                  outputVector->GetInformationObject(0);<br>
                                    
                                  vtkDataObject::SetPointDataActiveScalarInfo(outInfo,
                                  VTK_UNSIGNED_CHAR, 1);<br>
                                  <br>
                                     return 1;<br>
                                  }<br>
                                  <br>
                                  int
                                  vtkPVPROTOImageReader::RequestData(vtkInformation
                                  *vtkNotUsed(request),<br>
                                                                        
                                  vtkInformationVector **inputVector,<br>
                                                                        
                                  vtkInformationVector *outputVector)<br>
                                  {<br>
                                </div>
                                <div>   ... conversion code from
                                  protobuf<br>
                                </div>
                                <div><br>
                                    /* Convert from protobuf to
                                  vtkImageData */<br>
                                    vtkSmartPointer<vtkImageData>
                                  image = "function converting to
                                  protobuf";<br>
                                  <br>
                                    vtkDataArray* scalars =
                                  image->GetPointData()->GetScalars();<br>
                                   
                                  scalars->SetName("ReconstructionData");<br>
                                  <br>
                                    /* Get the info object */<br>
                                    vtkInformation *outInfo =
                                  outputVector->GetInformationObject(0);<br>
                                   
                                  outInfo->Set(vtkDataObject::DATA_TYPE_NAME(),
                                  "vtkImageData");<br>
                                  <br>
                                    /* Get the output */<br>
                                    vtkImageData* output =
                                  vtkImageData::GetData(outputVector);<br>
                                  <br>
                                  // 
                                  output->SetSpacing(image->GetSpacing());<br>
                                  // 
                                  output->SetOrigin(image->GetOrigin());<br>
                                  // 
                                  output->AllocateScalars(outInfo);<br>
                                  // 
output->GetPointData()->SetScalars(image->GetPointData()->GetScalars());<br>
                                  // 
                                  output->SetDimensions(image->GetDimensions());<br>
                                  <br>
                                    output->ShallowCopy(image);<br>
                                  <br>
                                    int* dimensions =
                                  output->GetDimensions();<br>
                                  <br>
                                    std::cout << "\nNumber of
                                  points: " <<
                                  output->GetNumberOfPoints()
                                  << std::endl;<br>
                                    std::cout << "Number of cells:
                                  " <<
                                  output->GetNumberOfCells() <<
                                  "\n" << std::endl;<br>
                                  <br>
                                </div>
                                // print out the pixel values to see if
                                they are actually present<br>
                                <div>  for (int z = 0; z <
                                  dimensions[2]; z++)<br>
                                    {<br>
                                      for (int y = 0; y <
                                  dimensions[1]; y++)<br>
                                      {<br>
                                        for (int x = 0; x <
                                  dimensions[0]; x++)<br>
                                        {<br>
                                          double* pixel =
                                  static_cast<double*>(output->GetScalarPointer(x,y,z));<br>
                                          // do something with v<br>
                                          std::cout << "pixel
                                  value: " << pixel[0] <<
                                  "\n";<br>
                                        }<br>
                                        std::cout << std::endl;<br>
                                      }<br>
                                      std::cout << std::endl;<br>
                                    }<br>
                                  <br>
                                    // write output to file and compare
                                  in visualization window...<br>
                                   
                                  vtkSmartPointer<vtkXMLImageDataWriter>
                                  vtk_writer =
                                  vtkSmartPointer<vtkXMLImageDataWriter>::New();<br>
                                    vtk_writer->SetInputData(output);<br>
                                    vtk_writer->SetFileName(
                                  "/home/kdean/tmp/foo.vti" );<br>
                                    vtk_writer->Update();<br>
                                    vtk_writer->Write();<br>
                                  <br>
                                    return 1;<br>
                                  }<br>
                                  <br>
                                  <br>
                                </div>
                                <div>Another Problem I ran into:<br>
                                </div>
                                <div>So I had to hardcode a file for the
                                  char *FileName into the RequestData
                                  Function in order to read any protobuf
                                  file. I ran a debugger on the code,
                                  and it seems like these functions from
                                  the header file (of the reader):<br>
                                  <br>
                                  vtkGetStringMacro(FileName);<br>
                                  vtkSetStringMacro(FileName);<br>
                                  <br>
                                </div>
                                <div>they are never getting called.<br>
                                  <br>
                                </div>
                                <div>Thanks,<br>
                                  <br>
                                </div>
                                <div>Kevin<br>
                                  <br>
                                </div>
                                <div>here are my xml too... it looks
                                  right, but maybe I am missing
                                  something.<br>
                                </div>
                              </div>
                              <div class="gmail_extra"><br>
                                <div class="gmail_quote">On Sun, May 3,
                                  2015 at 7:04 AM, Utkarsh Ayachit <span
                                    dir="ltr"><<a
                                      moz-do-not-send="true"
                                      href="mailto:utkarsh.ayachit@kitware.com"
                                      target="_blank">utkarsh.ayachit@kitware.com</a>></span>
                                  wrote:<br>
                                  <blockquote class="gmail_quote"
                                    style="margin:0 0 0
                                    .8ex;border-left:1px #ccc
                                    solid;padding-left:1ex">You can also
                                    use the Information panel to see
                                    what arrays are being<br>
                                    read in and what their ranges are.<br>
                                    <br>
                                    On Sat, May 2, 2015 at 7:06 PM,
                                    Dean, Kevin<br>
                                    <span><<a moz-do-not-send="true"
href="mailto:kevin.dean@decisionsciencescorp.com" target="_blank">kevin.dean@decisionsciencescorp.com</a>>


                                      wrote:<br>
                                      > looked at the spreadsheet
                                      view in the GUI, and it looks like
                                      none of the<br>
                                      > Point Data is actually being
                                      copied...<br>
                                      ><br>
                                      > On Sat, May 2, 2015 at 3:44
                                      PM, Dean, Kevin<br>
                                      > <<a moz-do-not-send="true"
href="mailto:kevin.dean@decisionsciencescorp.com" target="_blank">kevin.dean@decisionsciencescorp.com</a>>


                                      wrote:<br>
                                      >><br>
                                      >> What's up Utkarsh?<br>
                                      >><br>
                                      >> So I was able to write
                                      that plugin and convert my image
                                      to the<br>
                                      >> vtkImageData. However, I
                                      am having trouble visualizing the
                                      image. However,<br>
                                      >> when I write out the
                                      output from my reader, the image
                                      gets written<br>
                                      >> correctly... Here are
                                      some pictures to show the
                                      differences. (All the<br>
                                      >> information for the
                                      images is exactly the same) Do you
                                      have an idea of how I<br>
                                      >> can try to fix it?
                                      Thanks.<br>
                                      >><br>
                                      >> Kevin E. Dean<br>
                                      ><br>
                                      ><br>
                                      ><br>
                                    </span>> This email and its
                                    contents are confidential. If you
                                    are not the intended<br>
                                    > recipient, please do not
                                    disclose or use the information
                                    within this email<br>
                                    > or its attachments. If you have
                                    received this email in error, please
                                    report<br>
                                    > the error to the sender by
                                    return email and delete this
                                    communication from<br>
                                    > your records.<br>
                                  </blockquote>
                                </div>
                                <br>
                              </div>
                              <br>
                              <span><font color="#888888">This email and
                                  its contents are confidential. If you
                                  are not the intended recipient, please
                                  do not disclose or use the information
                                  within this email or its attachments.
                                  If you have received this email in
                                  error, please report the error to the
                                  sender by return email and delete this
                                  communication from your records.</font></span>
                              <br>
                              <fieldset></fieldset>
                              <br>
                            </div>
                          </div>
                          <pre>_______________________________________________
Powered by <a moz-do-not-send="true" href="http://www.kitware.com" target="_blank">www.kitware.com</a>

Visit other Kitware open-source projects at <a moz-do-not-send="true" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the ParaView Wiki at: <a moz-do-not-send="true" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a>

Search the list archives at: <a moz-do-not-send="true" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a>

Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a>
</pre>
                        </blockquote>
                        <br>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </div>
          <br>
        </div>
        <br>
        <span><font color="#888888">This email and its contents are
            confidential. If you are not the intended recipient, please
            do not disclose or use the information within this email or
            its attachments. If you have received this email in error,
            please report the error to the sender by return email and
            delete this communication from your records.</font></span> <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Powered by <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the ParaView Wiki at: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>

Search the list archives at: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://markmail.org/search/?q=ParaView">http://markmail.org/search/?q=ParaView</a>

Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a>
</pre>
      </blockquote>
      <br>
      <br>
    </div>
    <br>
  </body>
</html>