<br clear="all">Hello, everyone!<br>I wrote my own reader plugin for my custom data format.<br>But when I use it, it seems do NOT work!<br>It seems can NOT execute the function RequetInformation.<br>Should I use the method ProcessRequest()?<br>
May some one can help me out?<br>Thanks so much!<br><br>Here are my some parts of codes:<br><br clear="all">int vtkSgnReader::<div id=":153" class="ii gt">RequestInformation(vtkInformation *vtkNotUsed(request),<br> vtkInformationVector **vtkNotUsed(inputVector),<br>
vtkInformationVector *outputVector)<br>{<br> vtkInformation *outInfo = outputVector->GetInformationObject(0);<br> return this->ReadMetaData(outInfo);<br>}<br><br>
int vtkSgnReader::ReadMetaData(vtkInformation *outInfo)<br>{<br> if (!sgnfile->Readsgn(FileName))<br> {<br> return 1;<br> }<br> int dim[3];<br> dim[0]=sgnfile->GetNx();<br> dim[1]=sgnfile->GetNy();<br>
dim[2]=sgnfile->GetNz();<br> //Set the extent<br> outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),<br> 0, dim[0]-1, 0, dim[1]-1, 0, dim[2]-1);<br> return 1;<br>}<br><br>
int vtkSgnReader::RequestData(vtkInformation *vtkNotUsed(request), <br> vtkInformationVector **vtkNotUsed(inputVector),<br> vtkInformationVector *outputVector)<br>
{<br> vtkInformation *outInfo = outputVector->GetInformationObject(0);<br> vtkImageData *output = vtkImageData::GetData(outInfo);<br> int *extent = output->GetUpdateExtent();<br> int numPts=0;<br> int L, M, N;<br>
if (!sgnfile->Readsgn(FileName))<br> {<br> return 1;<br> }<br> int dim[3];<br> dim[0] = sgnfile->GetNx();<br> L = dim[0];<br> dim[1] = sgnfile->GetNy();<br> M = dim[1];<br> dim[2] = sgnfile->GetNz();<br>
N = dim[2];<br> numPts = dim[0]*dim[1]*dim[2];<br> output->SetExtent(extent);<br> output->SetOrigin(origin);<br> output->SetSpacing(ar);<br><br> //set the scalar data<br> vtkShortArray *castkey = vtkShortArray::New();<br>
castkey->SetName("casting_type");<br> castkey->SetNumberOfComponents(1);<br> castkey->SetNumberOfTuples(numPts);<br> for (int i=0; i<L; i++) for (int j=0;j<M; j++) for (int k=0; k<N; k++)<br>
{ <br> int idx = i*M*N+j*N+k;<br> castkey->SetTupleValue( idx, &(sgnfile->GetSGNData()[idx]) ); <br> }<br> output->GetPointData()->AddArray(castkey);<br> castkey->Delete(); <br>
return 1;<br>}<br><br>Do I have something wrong with my code?<br>Thank you so much for your truly help!<br><br>-Seven</div><br>-- <br><a href="mailto:shenyanwen@gmail.com">shenyanwen@gmail.com</a><br>Mobile Phone:13476177952<br>
Tel: 027-87558144<br>