<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey,<br>
<br>
I tried this:<br>
<br>
int *numPoints = threshold1->GetOutput()->GetDimensions();<br>
VTK_PTR_CREATE(vtkIntArray, axisX);<br>
axisX->SetName("Axis X");<br>
VTK_PTR_CREATE(vtkIntArray, axisY);<br>
axisX->SetName("Axis Y");<br>
VTK_PTR_CREATE(vtkIntArray, values);<br>
axisX->SetName("Values");<br>
table->AddColumn(axisX);<br>
table->AddColumn(axisY);<br>
table->AddColumn(values);<br>
table->SetNumberOfRows(data->GetNumberOfPoints());
//520*520*47<br>
int row = 0;<br>
cout << "numoints " << data->GetNumberOfPoints()
<< endl;<br>
//
<meta name="qrichtext" content="1">
<span style=" font-family:'Monospace'; font-size:9pt;
color:#bbbbbb;">numoints 12708800</span>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--EndFragment--></p>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap;</style> for (unsigned int x = 0; x
< numPoints[0]; x++)<br>
{<br>
table->SetValue(row,0,x);<br>
for(unsigned int y = 0; y < numPoints[1]; y++)<br>
{<br>
table->SetValue(row,1,y);<br>
for(unsigned int z = 0; z < numPoints[2]; z++)<br>
{<br>
unsigned int val = *static_cast<unsigned
int*>(threshold1->GetOutput()->GetScalarPointer(x,y,z));<br>
table->SetValue(row++,2,val);<br>
}<br>
}<br>
}<br>
VTK_PTR_CREATE(vtkChartXYZ, chart);<br>
VTK_PTR_CREATE(vtkPlotSurface, plot);<br>
VTK_PTR_CREATE(vtkContextView, view);<br>
<br>
view->GetRenderer()->SetBackground(1, 1, 1);<br>
view->GetScene()->AddItem(chart);<br>
plot->SetInputData(table);<br>
<br>
imgDisplay->GetRenderWindow()->AddRenderer(view->GetRenderer());<br>
view->GetRenderWindow()->SetMultiSamples(0);<br>
view->SetInteractor(imgDisplay->GetInteractor());<br>
imgDisplay->SetRenderWindow(view->GetRenderWindow());<br>
// Visualize the histogram<br>
<br>
// Initialize the event loop and then start it<br>
imgDisplay->show();<br>
view->GetInteractor()->Initialize();<br>
view->GetInteractor()->Start();<br>
<br>
but Qt throws exceptions. I think I stick with the other solution,
except you guys have some solutions for me, which would be great
(imgDisplay is a QVTKWidget, this works fine with vtkChartXY). The
error message:<br>
<meta name="qrichtext" content="1">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment--><span style=" font-family:'Monospace'; font-size:9pt; color:#e83e3e;">Qt has caught an exception thrown from an event handler. Throwing</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#e83e3e;">exceptions from an event handler is not supported in Qt. You must</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#e83e3e;">reimplement QApplication::notify() and catch all exceptions there.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monospace'; font-size:9pt; color:#e83e3e;">
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#e83e3e;">terminate called after throwing an instance of 'std::bad_alloc'</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#e83e3e;"> what(): std::bad_alloc</span><!--EndFragment--></p>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
<br>
<br>
<div class="moz-cite-prefix">Am 08.12.2015 um 22:50 schrieb Imre
Goretzki:<br>
</div>
<blockquote cite="mid:566750BD.1050406@gmail.com" type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
Hey Cory,<br>
<br>
I have some troubles combining vtkImageData with the vtkTable. I
tried the following:<br>
<br>
vtkSmartPointer<vtkImageThreshold> threshold1 =<br>
vtkSmartPointer<vtkImageThreshold>::New();<br>
threshold1->SetInputData(con->GetOutput());<br>
threshold1->ThresholdBetween(lower, upper);<br>
threshold1->ReplaceInOn();<br>
threshold1->SetInValue(CLASS_1_VALUE);<br>
threshold1->Update();<br>
<br>
unsigned int numPoints =
threshold1->GetOutput()->GetNumberOfPoints();<br>
for (unsigned int dimension = 0; dimension < 3;
dimension++)<br>
{<br>
std::stringstream colName;<br>
colName << "dimension" << dimension;<br>
VTK_PTR_CREATE(vtkIntArray, values);<br>
values->SetNumberOfComponents(1);<br>
values->SetName(colName.str().c_str());<br>
values->SetNumberOfTuples(numPoints);<br>
<br>
for(unsigned int pt = 0; pt < numPoints; pt++)<br>
{<br>
double point[3];<br>
double originalPoint[3];<br>
threshold1->GetOutput()->GetPoint(pt, point);<br>
data->GetPoint(pt, originalPoint);<br>
values->SetValue(pt, originalPoint[dimension]);<br>
bool lg2 = originalPoint[dimension] > lower
&& originalPoint[dimension] < upper;<br>
if (lg2)<br>
{<br>
cout << "original between, so " <<
(unsigned int)point[dimension] << endl;<br>
}<br>
else<br>
{<br>
cout << "mh " <<
originalPoint[dimension] << [...] << endl;<br>
}<br>
}<br>
table->AddColumn(values);<br>
}<br>
<br>
Unfortunately, the outputs I get are pretty useless in my
scenario:<br>
<meta name="qrichtext" content="1">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment--><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 279 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 280 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 281 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 282 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 283 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 284 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 285 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 286 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 287 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 288 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 289 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 290 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 291 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 292 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 293 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 294 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 295 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 296 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 297 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 298 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 299 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 300 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 301 lower 970 upper 990</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Monospace'; font-size:9pt; color:#bbbbbb;">mh 302 lower 970 upper 990</span><!--EndFragment--></p>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
These are just my dimensions, so it repeats the numbers 0 to 519.<br>
<br>
VTK_PTR_CREATE(type,name) is defined as
vtkSmartPointer<type> name =
vtkSmartPointer<type>::New();<br>
<br>
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.<br>
<br>
Greetings<br>
Imre<br>
<br>
<div class="moz-cite-prefix">Am 06.12.2015 um 17:48 schrieb Imre
Goretzki:<br>
</div>
<blockquote cite="mid:566466CE.6090405@gmail.com" type="cite">
<meta content="text/html; charset=utf-8"
http-equiv="Content-Type">
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.<br>
<br>
<div class="moz-cite-prefix">Am 06.12.2015 um 17:38 schrieb Cory
Quammen:<br>
</div>
<blockquote
cite="mid:CAB5Fpx5dx6T+jiv9VJbUQLRigVT7UboaZ3ERyGKe8pSns9gfgQ@mail.gmail.com"
type="cite">
<div dir="ltr">Imre,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>- Cory</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Dec 6, 2015 at 6:23 AM,
Imre Goretzki <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:goretzki.imre@gmail.com" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:goretzki.imre@gmail.com">goretzki.imre@gmail.com</a></a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hey guys,<br>
<br>
here is a 2D example of what I wanted to do. I think
data transformation would not be the correct way of
doing this.
<div>
<div class="h5"><br>
<br>
<br>
<div>Am 05.12.2015 um 09:35 schrieb Imre Goretzki:<br>
</div>
<blockquote type="cite"> Cory,<br>
<br>
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.<br>
<br>
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.<br>
<br>
Imre<br>
<br>
<div>Am 04.12.2015 um 20:56 schrieb Cory
Quammen:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Imre,
<div><br>
</div>
<div>Your best bet is probably to transform
the data itself rather than the user
transform of the actors.</div>
<div><br>
</div>
<div>vtkSmartPointer<vtkTransformFilter>
transformFilter =
vtkSmartPointer<vtkTransformFilter>::New();</div>
<div>transformFilter->SetTransform(axis);</div>
<div>transformFilter->SetInputData(<your
input data>);</div>
<div><br>
</div>
<div>HTH,</div>
<div>Cory</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Dec 4, 2015
at 1:48 PM, Imre Goretzki <span dir="ltr"><<a
moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:goretzki.imre@gmail.com"><a class="moz-txt-link-abbreviated" href="mailto:goretzki.imre@gmail.com">goretzki.imre@gmail.com</a></a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">I have data
like this:<br>
<a moz-do-not-send="true"
href="http://i.imgur.com/CR2O8Ik.png"
rel="noreferrer" target="_blank">http://i.imgur.com/CR2O8Ik.png</a><br>
and I would like to "stretch" the Z-axis
to get more like a cube visualization.<br>
<br>
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.<br>
<br>
The vtkTransform plot stretches to much:<br>
<a moz-do-not-send="true"
href="http://i.imgur.com/DDUW91T.png"
rel="noreferrer" target="_blank">http://i.imgur.com/DDUW91T.png</a><br>
The data is deformed<br>
<br>
I use the vtkTransform like this:<br>
vtkSmartPointer<vtkTransform> axis
=
vtkSmartPointer<vtkTransform>::New();<br>
axis->Scale(1,1,10);<br>
<br>
dataActor->SetUserTransform(axis);<br>
outlineActor->SetUserTransform(axis);<br>
<br>
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.<br>
<br>
For matlab reference, something like
this:<br>
<a moz-do-not-send="true"
href="http://de.mathworks.com/help/matlab/ref/axis.html?refresh=true"
rel="noreferrer" target="_blank">http://de.mathworks.com/help/matlab/ref/axis.html?refresh=true</a><br>
<br>
Would be nice if you could help me<span><font
color="#888888"><br>
<br>
Imre</font></span>
<div>
<div><br>
<br>
Am 03.12.2015 um 22:20 schrieb Imre
Goretzki:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0
.8ex;border-left:1px #ccc
solid;padding-left:1ex"> Hey guys<br>
<br>
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?<br>
<br>
I hope you can help<br>
<br>
Thanks<br>
Imre<br>
<br>
</blockquote>
<br>
_______________________________________________<br>
Powered by <a
moz-do-not-send="true"
href="http://www.kitware.com"
rel="noreferrer" target="_blank"><a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a></a><br>
<br>
Visit other Kitware open-source
projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank"><a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a><br>
<br>
Please keep messages on-topic and
check the VTK FAQ at: <a
moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://www.vtk.org/Wiki/VTK_FAQ"><a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a></a><br>
<br>
Search the list archives at: <a
moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://markmail.org/search/?q=vtkusers"><a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a></a><br>
<br>
Follow this link to
subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>Cory Quammen<br>
R&D Engineer<br>
Kitware, Inc.</div>
</div>
</blockquote>
<br>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">Cory Quammen<br>
R&D Engineer<br>
Kitware, Inc.</div>
</div>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>