<div dir="ltr">Hello all,<div><br></div><div>   I am trying to write a subclass of vtkImageAlgorithm to generate a 2D image based on a reslice of a 3D image. When I execute it, it was fine with vtk 6.1 but it has some problems with vtk 6.2. I don't know what has changed. I think it might be related to RequestInformation.</div><div><br></div><div>The errors are: </div><div><br></div><div><div>ERROR: In D:\Library\VTK\VTK-6.2.0\Common\ExecutionModel\vtkStreamingDemandDrivenPipeline.cxx, line 857</div><div>vtkStreamingDemandDrivenPipeline (0000000010C8E3F0): The update extent specified in the information for output port 0 on algorithm vtkTrivialProducer(00000000111F6860) is 0 40 0 201 0 0, which is outside the whole extent 0 40 0 40 0 0.</div><div><br></div><div>ERROR: In D:\Library\VTK\VTK-6.2.0\Common\ExecutionModel\vtkTrivialProducer.cxx, line 279</div><div>vtkTrivialProducer (00000000111F6860): This data object does not contain the requested extent.</div></div><div><br></div><div>Here is my code:</div><div><br></div><div><div>ImageCurvedReformat::ImageCurvedReformat( )</div><div>{</div><div><span class="" style="white-space:pre">   </span>this->SegmentId  = -1;</div><div><span class="" style="white-space:pre"> </span>this->TwistIndex = 0;</div><div><br></div><div><span class="" style="white-space:pre">  </span>this->RadialSpacing  = 0.5;</div><div><span class="" style="white-space:pre">    </span>this->RadialExtent   = 20;</div><div><br></div><div><span class="" style="white-space:pre">    </span>this->UpdateImage = 1;</div><div><br></div><div><span class="" style="white-space:pre"> </span>this->SetNumberOfInputPorts( 2 );</div><div><span class="" style="white-space:pre">       </span>this->SetNumberOfOutputPorts( 6 );</div><div><br></div><div><span class="" style="white-space:pre">     </span>// by default process active point scalars</div><div><span class="" style="white-space:pre"> </span>this->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,</div><div><span class="" style="white-space:pre">             </span>vtkDataSetAttributes::SCALARS);</div><div>}</div><div><br></div><div>ImageCurvedReformat::~ImageCurvedReformat( )</div><div>{</div><div>}</div><div><br></div><div>void ImageCurvedReformat::SetUpdateImage(int update)</div><div>{</div><div><span class="" style="white-space:pre">    </span>if(this->UpdateImage != update) this->UpdateImage = update;</div><div><span class="" style="white-space:pre">  </span>//Don't set the modiflied flag on purpose</div><div>}</div><div><br></div><div>vtkImageData* ImageCurvedReformat::GetOutput()</div><div>{</div><div><span class="" style="white-space:pre">        </span>return vtkImageData::SafeDownCast(this->GetOutput(0));</div><div>}</div><div><br></div><div>vtkDataObject* ImageCurvedReformat::GetOutput(int port)</div><div>{</div><div><span class="" style="white-space:pre">   </span>return this->GetOutputDataObject(port);</div><div>}</div><div><br></div><div>int ImageCurvedReformat::ProcessRequest(vtkInformation* request,</div><div><span class="" style="white-space:pre">                                                                         </span>vtkInformationVector** inputVector,</div><div><span class="" style="white-space:pre">                                                                                </span>vtkInformationVector* outputVector)</div><div>{</div><div><span class="" style="white-space:pre">        </span>if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_NOT_GENERATED()))</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre">          </span>if(!this->UpdateImage)</div><div><span class="" style="white-space:pre">          </span>{</div><div><span class="" style="white-space:pre">                  </span>vtkInformation* outImageInfo = outputVector->GetInformationObject(0);</div><div><span class="" style="white-space:pre">                   </span>outImageInfo->Set(vtkDemandDrivenPipeline::DATA_NOT_GENERATED(), 1);</div><div><span class="" style="white-space:pre">                    </span>vtkInformation* outImagePolyInfo = outputVector->GetInformationObject(5);</div><div><span class="" style="white-space:pre">                       </span>outImagePolyInfo->Set(vtkDemandDrivenPipeline::DATA_NOT_GENERATED(), 1);</div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">  </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>// generate the data</div><div><span class="" style="white-space:pre">       </span>if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))</div><div><span class="" style="white-space:pre">       </span>{</div><div><span class="" style="white-space:pre">          </span>return this->RequestData(request, inputVector, outputVector);</div><div><span class="" style="white-space:pre">   </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>// execute information</div><div><span class="" style="white-space:pre">     </span>if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))</div><div><span class="" style="white-space:pre">        </span>{</div><div><span class="" style="white-space:pre">          </span>return this->RequestInformation(request, inputVector, outputVector);</div><div><span class="" style="white-space:pre">    </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>// propagate update extent</div><div><span class="" style="white-space:pre"> </span>/*</div><div><span class="" style="white-space:pre"> </span>if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))</div><div><span class="" style="white-space:pre">     </span>{</div><div><span class="" style="white-space:pre">          </span>return this->RequestUpdateExtent(request, inputVector, outputVector);</div><div><span class="" style="white-space:pre">   </span>}</div><div><span class="" style="white-space:pre">  </span>*/</div><div><br></div><div><span class="" style="white-space:pre">        </span>return this->Superclass::ProcessRequest(request, inputVector, outputVector);</div><div>}</div><div><br></div><div>//---------------------------------------------------------------------------</div><div>int ImageCurvedReformat::FillInputPortInformation(int port, vtkInformation *info)</div><div>{</div><div><span class="" style="white-space:pre">       </span>if( port == 0 )</div><div><span class="" style="white-space:pre">            </span>info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkImageData");</div><div><span class="" style="white-space:pre">  </span>else if( port == 1 )</div><div><span class="" style="white-space:pre">               </span>info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");</div><div><br></div><div><span class="" style="white-space:pre">  </span>return 1;</div><div>}</div><div><br></div><div>//----------------------------------------------------------------------------</div><div>int ImageCurvedReformat::FillOutputPortInformation(</div><div><span class="" style="white-space:pre">  </span>int port, vtkInformation* info)</div><div>{</div><div><span class="" style="white-space:pre">    </span>if( port == 0 )</div><div><span class="" style="white-space:pre">            </span>info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkImageData");</div><div><span class="" style="white-space:pre">   </span>else if ( port < 6 )</div><div><span class="" style="white-space:pre">            </span>info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkPolyData");</div><div><span class="" style="white-space:pre">    </span>return 1;</div><div>}</div><div><br></div><div>int ImageCurvedReformat::RequestInformation (</div><div><span class="" style="white-space:pre">     </span>vtkInformation * request,</div><div><span class="" style="white-space:pre">  </span>vtkInformationVector** inputVector,</div><div><span class="" style="white-space:pre">        </span>vtkInformationVector *outputVector)</div><div>{</div><div><span class="" style="white-space:pre">        </span>vtkInformation *inCenterlineInfo = inputVector[1]->GetInformationObject(0);</div><div><span class="" style="white-space:pre">     </span>vtkInformation *outImageInfo<span class="" style="white-space:pre">      </span> = outputVector->GetInformationObject(0);</div><div><br></div><div><span class="" style="white-space:pre">      </span>vtkPolyData<span class="" style="white-space:pre">       </span>   *inputCenterline  = vtkPolyData::SafeDownCast(inCenterlineInfo->Get(vtkDataObject::DATA_OBJECT()));</div><div><br></div><div><span class="" style="white-space:pre">       </span>if( SegmentId >= 0 && SegmentId < inputCenterline->GetNumberOfCells() )</div><div><span class="" style="white-space:pre">   </span>{</div><div><span class="" style="white-space:pre">          </span>vtkIdType npts=0, *pts=NULL;</div><div><span class="" style="white-space:pre">               </span>int RadialSize = 2*this->RadialExtent+1;</div><div><span class="" style="white-space:pre">                </span>inputCenterline->BuildCells();</div><div><span class="" style="white-space:pre">          </span>inputCenterline->GetCellPoints(SegmentId, npts, pts);</div><div><span class="" style="white-space:pre">           </span>int outWholeExt[6] = {0, RadialSize-1, 0, npts-1, 0, 0};</div><div><span class="" style="white-space:pre">           </span>outImageInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),outWholeExt,6);</div><div><span class="" style="white-space:pre">      </span>}</div><div><span class="" style="white-space:pre">  </span>else</div><div><span class="" style="white-space:pre">       </span>{</div><div><span class="" style="white-space:pre">          </span>int outWholeExt[6] = {0, 0, 0, 0, 0, 0};</div><div><span class="" style="white-space:pre">           </span>outImageInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),outWholeExt,6);</div><div><span class="" style="white-space:pre">      </span>}</div><div><span class="" style="white-space:pre">  </span>double outOrigin[3] = {0.0, 0.0, 0.0};</div><div><span class="" style="white-space:pre">     </span>outImageInfo->Set(vtkDataObject::ORIGIN(), outOrigin, 3);</div><div><br></div><div><span class="" style="white-space:pre">      </span>return Superclass::RequestInformation(request, inputVector, outputVector);</div><div>}</div><div><br></div><div>int ImageCurvedReformat::RequestData(</div><div><span class="" style="white-space:pre">    </span>vtkInformation *vtkNotUsed(request),</div><div><span class="" style="white-space:pre">       </span>vtkInformationVector **inputVector,</div><div><span class="" style="white-space:pre">        </span>vtkInformationVector *outputVector)</div><div>{</div></div><div><br></div><div>//Do some work to do image reformat.</div><div>}</div><div><br></div><div>   Can you help?</div><div><br></div><div>Thanks,</div><div>Mengda</div></div>