[vtkusers] axis equal for vtk?

Imre Goretzki goretzki.imre at gmail.com
Tue Dec 8 16:50:53 EST 2015


Hey Cory,

I have some troubles combining vtkImageData with the vtkTable. I tried 
the following:

vtkSmartPointer<vtkImageThreshold> threshold1 =
         vtkSmartPointer<vtkImageThreshold>::New();
threshold1->SetInputData(con->GetOutput());
threshold1->ThresholdBetween(lower, upper);
threshold1->ReplaceInOn();
threshold1->SetInValue(CLASS_1_VALUE);
threshold1->Update();

unsigned int numPoints = threshold1->GetOutput()->GetNumberOfPoints();
     for (unsigned int dimension = 0; dimension < 3; dimension++)
     {
         std::stringstream colName;
         colName << "dimension" << dimension;
         VTK_PTR_CREATE(vtkIntArray, values);
         values->SetNumberOfComponents(1);
         values->SetName(colName.str().c_str());
         values->SetNumberOfTuples(numPoints);

         for(unsigned int pt = 0; pt < numPoints; pt++)
         {
             double point[3];
             double originalPoint[3];
             threshold1->GetOutput()->GetPoint(pt, point);
             data->GetPoint(pt, originalPoint);
             values->SetValue(pt, originalPoint[dimension]);
             bool lg2 = originalPoint[dimension] > lower && 
originalPoint[dimension] < upper;
             if (lg2)
             {
                 cout << "original between, so " << (unsigned 
int)point[dimension] << endl;
             }
             else
             {
                 cout << "mh " << originalPoint[dimension] << [...] << endl;
             }
         }
         table->AddColumn(values);
     }

Unfortunately, the outputs I get are pretty useless in my scenario:

mh 279 lower 970 upper 990

mh 280 lower 970 upper 990

mh 281 lower 970 upper 990

mh 282 lower 970 upper 990

mh 283 lower 970 upper 990

mh 284 lower 970 upper 990

mh 285 lower 970 upper 990

mh 286 lower 970 upper 990

mh 287 lower 970 upper 990

mh 288 lower 970 upper 990

mh 289 lower 970 upper 990

mh 290 lower 970 upper 990

mh 291 lower 970 upper 990

mh 292 lower 970 upper 990

mh 293 lower 970 upper 990

mh 294 lower 970 upper 990

mh 295 lower 970 upper 990

mh 296 lower 970 upper 990

mh 297 lower 970 upper 990

mh 298 lower 970 upper 990

mh 299 lower 970 upper 990

mh 300 lower 970 upper 990

mh 301 lower 970 upper 990

mh 302 lower 970 upper 990


These are just my dimensions, so it repeats the numbers 0 to 519.

VTK_PTR_CREATE(type,name) is defined as vtkSmartPointer<type> name = 
vtkSmartPointer<type>::New();

So obviously, this approach is wrong. The examples, given in the wiki, 
correspond to given data points, not image data. Can you help me? I 
think this class would be great as far as I can tell by using vtkChartXY 
for plotting a histogram.

Greetings
Imre

Am 06.12.2015 um 17:48 schrieb Imre Goretzki:
> No I have not. Thank you. If I am having troubles or if that is not 
> the plot that I am looking for, I respond again.
>
> Am 06.12.2015 um 17:38 schrieb Cory Quammen:
>> Imre,
>>
>> Have you looked at the charting API, e.g., vtkChartXYZ? I don't know 
>> if that does exactly what you want, but it may be more in line with 
>> what you are after.
>>
>> - Cory
>>
>> On Sun, Dec 6, 2015 at 6:23 AM, Imre Goretzki 
>> <goretzki.imre at gmail.com <mailto:goretzki.imre at gmail.com>> wrote:
>>
>>     Hey guys,
>>
>>     here is a 2D example of what I wanted to do. I think data
>>     transformation would not be the correct way of doing this.
>>
>>
>>
>>     Am 05.12.2015 um 09:35 schrieb Imre Goretzki:
>>>     Cory,
>>>
>>>     is it possible to change the tick of the axes? Right know using
>>>     the transform filter is equivalent to the second image.
>>>     Unfortunately that is not what I would like to have. I think the
>>>     best way to do this is to change to tick of the Z-Dimension.
>>>
>>>     The image has the dimensions 520x520x47. So the tick for x and y
>>>     is 1, for z it should be 47/520. I don't want to change the data.
>>>
>>>     Imre
>>>
>>>     Am 04.12.2015 um 20:56 schrieb Cory Quammen:
>>>>     Imre,
>>>>
>>>>     Your best bet is probably to transform the data itself rather
>>>>     than the user transform of the actors.
>>>>
>>>>     vtkSmartPointer<vtkTransformFilter> transformFilter =
>>>>     vtkSmartPointer<vtkTransformFilter>::New();
>>>>     transformFilter->SetTransform(axis);
>>>>     transformFilter->SetInputData(<your input data>);
>>>>
>>>>     HTH,
>>>>     Cory
>>>>
>>>>     On Fri, Dec 4, 2015 at 1:48 PM, Imre Goretzki
>>>>     <goretzki.imre at gmail.com> wrote:
>>>>
>>>>         I have data like this:
>>>>         http://i.imgur.com/CR2O8Ik.png
>>>>         and I would like to "stretch" the Z-axis to get more like a
>>>>         cube visualization.
>>>>
>>>>         I used vtkTransform to transform the axes, but I would
>>>>         change the data if I do this. I hope you understand what I
>>>>         want to do, e.g. is there a possibility to change / stretch
>>>>         the ticks of a specific axis.
>>>>
>>>>         The vtkTransform plot stretches to much:
>>>>         http://i.imgur.com/DDUW91T.png
>>>>         The data is deformed
>>>>
>>>>         I use the vtkTransform like this:
>>>>         vtkSmartPointer<vtkTransform> axis =
>>>>         vtkSmartPointer<vtkTransform>::New();
>>>>         axis->Scale(1,1,10);
>>>>
>>>>         dataActor->SetUserTransform(axis);
>>>>         outlineActor->SetUserTransform(axis);
>>>>
>>>>         I tried using the camera with the vtkTransform, but the
>>>>         only thing I got from there, was an empty image or I had to
>>>>         zoom out greatly.
>>>>
>>>>         For matlab reference, something like this:
>>>>         http://de.mathworks.com/help/matlab/ref/axis.html?refresh=true
>>>>
>>>>         Would be nice if you could help me
>>>>
>>>>         Imre
>>>>
>>>>
>>>>         Am 03.12.2015 um 22:20 schrieb Imre Goretzki:
>>>>
>>>>             Hey guys
>>>>
>>>>             i'd like to ask you if there's a equivalent method for
>>>>             vtkRenderWindow for equalizing the axis, just like
>>>>             MATLABs axis equal. Could vtkAxesActor be helpful?
>>>>
>>>>             I hope you can help
>>>>
>>>>             Thanks
>>>>             Imre
>>>>
>>>>
>>>>         _______________________________________________
>>>>         Powered by www.kitware.com <http://www.kitware.com>
>>>>
>>>>         Visit other Kitware open-source projects at
>>>>         http://www.kitware.com/opensource/opensource.html
>>>>
>>>>         Please keep messages on-topic and check the VTK FAQ at:
>>>>         http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>>         Search the list archives at:
>>>>         http://markmail.org/search/?q=vtkusers
>>>>
>>>>         Follow this link to subscribe/unsubscribe:
>>>>         http://public.kitware.com/mailman/listinfo/vtkusers
>>>>
>>>>
>>>>
>>>>
>>>>     -- 
>>>>     Cory Quammen
>>>>     R&D Engineer
>>>>     Kitware, Inc.
>>>
>>
>>
>>
>>
>> -- 
>> Cory Quammen
>> R&D Engineer
>> Kitware, Inc.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151208/f7543116/attachment.html>


More information about the vtkusers mailing list