<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body 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<br>
<br>
<div class="moz-cite-prefix">On 05/04/2015 09:52 AM, Dean, Kevin
wrote:<br>
</div>
<blockquote
cite="mid:CAFvyM3R7azY0+UAS6VsM=iX579BzgwzGQqt_uMbOkBXukeGBFw@mail.gmail.com"
type="cite">
<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 class=""><<a moz-do-not-send="true"
href="mailto:kevin.dean@decisionsciencescorp.com">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">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 class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a 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 class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>
Search the list archives at: <a 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 class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/paraview">http://public.kitware.com/mailman/listinfo/paraview</a>
</pre>
</blockquote>
<br>
</body>
</html>