<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt">I create data in RequestDataObject() with:<br><br>vtkImageData* newoutput = vtkImageData::New();<br>outinfo->Set(vtkDataObject::DATA_OBJECT(), newoutput);<br>output->ReleaseData(); // so filters know it's empty<br>output->Delete();<br> <div><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>I've seen other filters do this as well. I've also seen it happen in the constructor of the filter.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color:
 rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>I also allocate the memory for the output in </span>RequestDataObject(). This might be a hack because should happen after setting extent in RequestData(), but it improves the speed somewhat. The size of the renderwindow determines the size of the output image (class has setter for this).</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">In RequestData() I do:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica
 Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">this->InternalRenderWindow->Render();</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">this->InternalRenderWindow->WaitForCompletion();</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">int* size = this->InternalRenderWindow->GetSize();</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
 Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">vtkInformation* info = outVector->GetInformationObject(0);</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">vtkImageData* output = vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">output->SetExtent(info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT()));<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
 HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">vtkFloatData* data = vtkFloatData::SafeDownCast(output->GetPointData()->GetScalars());</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">this->InternalRenderWindow->GetRGBAPixelData(0, 0, size[0]-1, size[1]-1, data);<br></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande,
 sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Tuesday, January 14, 2014 11:39:34 AM, David Gobbi <david.gobbi@gmail.com> wrote:<br> </font> </div>  <div class="y_msg_container">The order in which requests are processed is:<br clear="none">RequestDataObject()<br clear="none">RequestInformation()<br clear="none">RequestUpdateExtent()<br clear="none">RequestData()<br clear="none"><br clear="none">So I am a bit confused about how you are creating the data before you<br clear="none">Render the window that you get it from.<br clear="none"><div class="yqt6035140280" id="yqtfd43385"><br clear="none">On Tue, Jan 14, 2014 at 9:20 AM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br clear="none">> Yes, it has an internal pipeline. Apologies for not mentioning this, thought<br clear="none">> I did, must have been in an
 earlier email to the mailinglist...<br clear="none">><br clear="none">> I started with the vtkWindowToImageFilter class, but now taking data<br clear="none">> directly from an internal renderwindow because I want floats instead of<br clear="none">> unsigned chars.<br clear="none">> I don't make a ShallowCopy of the output, instead I create the data in<br clear="none">> RequestDataObject(). I do call Render() on the internal renderwindow in<br clear="none">> RequestData().<br clear="none">><br clear="none">> Basically I am trying to make a nice drr generator algorithm using the gpu<br clear="none">> mapper in vtk.<br clear="none">><br clear="none">> Maarten<br clear="none">><br clear="none">><br clear="none">> On Tuesday, January 14, 2014 11:07:21 AM, David Gobbi<br clear="none">> <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>>
 wrote:<br clear="none">> Your filter has an internal pipeline?  That would have been worth<br clear="none">> mentioning in your first email.<br clear="none">><br clear="none">> Are you doing a shallow copy to copy the output of the internal<br clear="none">> pipeline to the output of your filter?  Does your RequestData() method<br clear="none">> call the Update() method of the internal pipeline?<br clear="none">><br clear="none">> On Tue, Jan 14, 2014 at 8:42 AM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br clear="none">>> Thanks David,<br clear="none">>><br clear="none">>> Just before reading your email, I already added<br clear="none">>> inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), inExt);<br clear="none">>> 
 inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), inExt, 6);<br clear="none">>> to the code in RequestUpdateExtent() and that caused the errors to<br clear="none">>> disappear. But it is good to see it seems to work in another filter too<br clear="none">>> ;-)<br clear="none">>><br clear="none">>> Something is still wrong in the algorithm code though, because I need to<br clear="none">>> call Update() to get a sensible output. Without it, the output disappears<br clear="none">>> from the renderwindow after a new render (although the algorithm's<br clear="none">>> RequestData is called...?)<br clear="none">>><br clear="none">>> Maybe vtkImageHistogram will give me a clue, although I don't see an<br clear="none">>> internal pipeline in it...<br clear="none">>><br clear="none">>> Maarten<br clear="none">>><br clear="none">>><br clear="none">>> On
 Tuesday, January 14, 2014 9:58:09 AM, David Gobbi<br clear="none">>> <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br clear="none">>> wrote:<br clear="none">>> Hi Maarten,<br clear="none">>><br clear="none">>> In order to set the output extent independent of the input extent,<br clear="none">>> all you should have to do is override RequestInformation() and<br clear="none">>> RequestUpdateExtent().  It is definitely not necessary to set<br clear="none">>> UNRESTRICTED_UPDATE_EXTENT or EXACT_EXTENT.<br clear="none">>> Take a look at vtkImageHistogram.cxx as an example of a filter<br clear="none">>> that has a 3D input and an independently-sized 2D output.<br clear="none">>><br clear="none">>>  David<br clear="none">>><br clear="none">>> On Mon, Jan 13, 2014 at 1:45 PM, Maarten Beek
 <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br clear="none">>> wrote:<br clear="none">>>> Hi all,<br clear="none">>>><br clear="none">>>> I am trying to write an (image) algorithm that generates a 2d image from<br clear="none">>>> a<br clear="none">>>> 3d image.<br clear="none">>>> I would like to be able to set the resolution of the 2d image.<br clear="none">>>> The extents of the input and output are therefore unrelated.<br clear="none">>>><br clear="none">>>> I have the algorithm working when I set the algorithm's input in an<br clear="none">>>> unofficial way (SetNumberOfInputPorts(0), using a custom function<br clear="none">>>> SetInput<br clear="none">>>> instead of SetInputConnection or SetInputData). This way there is no<br clear="none">>>>
 pipeline created, which I would like to happen.<br clear="none">>>><br clear="none">>>> I set the whole extent of the algorithm's output to the desired (2d)<br clear="none">>>> extent<br clear="none">>>> in RequestInformation. However, the function<br clear="none">>>> vtkStreamingDemandDrivenPipeline::VerifyOutputInformation() fails because<br clear="none">>>> this whole extent miraculously gets re-set to whole (3d) extent of the<br clear="none">>>> input.<br clear="none">>>> I have tried to prevent this check using<br clear="none">>>><br clear="none">>>><br clear="none">>>> outInfo->Set(vtkStreamingDemandDrivenPipeline::UNRESTRICTED_UPDATE_EXTENT(),<br clear="none">>>> 1) and<br clear="none">>>> outInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 0) to no<br clear="none">>>> avail.<br
 clear="none">>>><br clear="none">>>> How do I prevent the adjustment of the whole extent after I have set it<br clear="none">>>> to<br clear="none">>>> the desired value?<br clear="none">>>><br clear="none">>>> Thanks - Maarten<br clear="none">>><br clear="none">>><br clear="none">><br clear="none">><br clear="none"></div><br><br></div>  </div> </div>  </div> </div></body></html>