Please keep discussion on the mailing list...<div><br></div><div>I assume you are using VTK 5.x</div><div><br></div><div>1) After you read the data with the reader, you desttory it with these statements:</div><div><div style="color:rgb(80,0,80);font-size:13px">
// Specify the size of the image data</div><div style="color:rgb(80,0,80);font-size:13px"> imageData->SetDimensions(675,401,450);</div><div style="color:rgb(80,0,80);font-size:13px">#if VTK_MAJOR_VERSION <= 5</div>
<div style="color:rgb(80,0,80);font-size:13px"> <font color="#ff6666"> imageData->SetNumberOfScalarComponents(GetNumberOfScalars+1);</font></div><div style="color:rgb(80,0,80);font-size:13px"> imageData->SetScalarTypeToInt();</div>
<div style="color:rgb(80,0,80);font-size:13px"><br></div><div style="color:rgb(80,0,80);font-size:13px"><br></div><div style="color:rgb(80,0,80);font-size:13px">#else</div><div style="color:rgb(80,0,80);font-size:13px"> imageData->AllocateScalars(VTK_DOUBLE,1);</div>
<div style="color:rgb(80,0,80);font-size:13px">#endif</div></div><div style="color:rgb(80,0,80);font-size:13px"><br></div><div style="color:rgb(80,0,80);font-size:13px">Remove them.</div><div><br><div class="gmail_quote">
On Wed, Jan 16, 2013 at 1:44 AM, shirani kannangara <span dir="ltr"><<a href="mailto:mangalika673@gmail.com" target="_blank">mangalika673@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="padding-bottom:0px;border-left-width:1px;border-left-style:solid;border-left-color:transparent;padding-left:8px"><div style="margin-left:44px"><div style="font-size:13px;direction:ltr;margin:5px 15px 0px 0px;padding-bottom:5px">
<div><div class="gmail_quote">On Tue, Jan 15, 2013 at 9:54 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" style="color:rgb(17,85,204)" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> imageData = reader->GetOutput</blockquote><div>Thank you very much Bill.The program was build with zero errorswith one warning as follows.Therefore the image reader did not work properly .Hence command window did not show the output.I will send everything for you for easy reference.</div>
<div><br></div><div><div style="color:rgb(80,0,80)"><div><br></div><div>#include <vtkSmartPointer.h></div><div>#include <vtkImageReader2.h></div><div>#include <vtkImageData.h></div><div>#include <vtkRenderWindow.h></div>
<div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkInteractorStyleImage.h></div><div>#include <vtkRenderer.h></div><div>#include <vtkImageActor.h></div><div>#include <vtkVersion.h></div>
<div>#include <vtkSmartPointer.h></div><div>#include <vtkImageData.h></div><div><br></div><div>int main(int argc, char *argv[])</div><div>{</div></div><div><span style="white-space:pre-wrap">        </span><font color="#ff0000">int GetNumberOfScalars;<span style="white-space:pre-wrap">        </span></font></div>
<div style="color:rgb(80,0,80)"><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>// Verify command line arguments</div><div> /*if(argc < 2)</div><div> {</div>
<div> std::cout << "Usage: " << argv[0]</div><div> << " InputFilename" << std::endl;</div><div> return EXIT_FAILURE;</div><div> }*/ </div><div> // Parse command line arguments</div>
<div> //std::string inputFilename =("D:\\rgbabdomen\\Debug\\output.vtk");</div><div> </div><div> // Read file</div><div> vtkSmartPointer<vtkImageReader2> reader =</div><div> vtkSmartPointer<vtkImageReader2>::New();</div>
<div> reader->SetFileName(("D:\\rgbabdomen\\Debug\\output.vtk"));</div><div> reader->SetDataScalarTypeToUnsignedChar();</div><div> reader->Update();</div><div> </div><div>//int main(int, char *[])</div>
<div><br></div><div> // Create an image data</div><div> vtkSmartPointer<vtkImageData> imageData = </div><div> vtkSmartPointer<vtkImageData>::New();</div><div> </div></div><div> imageData = reader->GetOutput();</div>
<div style="color:rgb(80,0,80)"><div> </div><div> // Specify the size of the image data</div><div> imageData->SetDimensions(675,401,450);</div><div>#if VTK_MAJOR_VERSION <= 5</div><div> <font color="#ff6666"> imageData->SetNumberOfScalarComponents(GetNumberOfScalars+1);</font></div>
<div> imageData->SetScalarTypeToInt();</div><div><br></div><div><br></div><div>#else</div><div> imageData->AllocateScalars(VTK_DOUBLE,1);</div><div>#endif</div><div> </div><div> int* dims = imageData->GetDimensions();</div>
<div> // int dims[3]; // can't do this</div><div> </div><div> std::cout << "Dims: " << " x: " << dims[0] << " y: " << dims[1] << " z: " << dims[2] << std::endl;</div>
<div> </div></div><div style="color:rgb(80,0,80)"><div> std::cout << "Number of points: " << imageData->GetNumberOfPoints() << std::endl;</div><div> std::cout << "Number of cells: " << imageData->GetNumberOfCells() << std::endl;</div>
</div><div> <font color="#ff0000">std::cout << "Number of scalars'' <<imageData->GetNumberOfScalars<<std::endl;</font></div><div><div style="margin:5px 0px"><div style="color:rgb(80,0,80);font-size:11px;background-color:rgb(241,241,241);border:1px solid rgb(221,221,221);clear:both;line-height:6px;outline:none;width:20px">
<div style="background-image:url(https://ssl.gstatic.com/ui/v1/icons/mail/ellipsis.png);min-height:8px;width:20px;background-repeat:no-repeat no-repeat"></div></div></div></div></div><div><br></div><div><br></div>
<div><font color="#cc33cc">output</font></div><div><div style="color:rgb(80,0,80)"><div><font color="#cc33cc">1>------ Build started: Project: ImageReader2, Configuration: Debug Win32 ------</font></div><div>
<font color="#cc33cc">1>Compiling...</font></div><div><font color="#cc33cc">1>imagereader.cxx</font></div></div><div><font color="#cc33cc">1>d:\dup2\imagereader.cxx(47) : warning C4700: uninitialized local variable 'GetNumberOfScalars' used</font></div>
<div><font color="#cc33cc">1>Linking...</font></div><div><font color="#cc33cc">1>Embedding manifest...</font></div><div style="color:rgb(80,0,80)"><div><font color="#cc33cc">1>Build log was saved at "file://d:\dup2\ImageReader2.dir\Debug\BuildLog.htm"</font></div>
<div><font color="#cc33cc">1>ImageReader2 - 0 error(s), 1 warning(s)</font></div><div><font color="#cc33cc">========== Build: 1 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========</font></div></div></div><div><font color="#33ff33"><br>
</font></div><div><font color="#6666cc">Debug Error</font></div><div><font color="#6666cc"><br></font></div><div><font color="#6666cc">Run-timeCheck Failure #3-The variable GetNumberOfScalars is being used without being initialized.</font></div>
<div><br></div><div><font color="#6666cc">Can you please show me the correct way of initializing "GetNumberOfScalars".</font></div><div><font color="#6666cc">Hope you will reply to me soon.</font></div><div><font color="#6666cc"><br>
</font></div><div><font color="#6666cc">regards </font></div><div style="outline:none;padding:10px 0px;width:22px;margin:2px 0px 0px"><div style="background-color:rgb(241,241,241);border:1px solid rgb(221,221,221);clear:both;line-height:6px;outline:none;width:20px">
<img src="https://mail.google.com/mail/images/cleardot.gif" style="background-image:url(https://ssl.gstatic.com/ui/v1/icons/mail/ellipsis.png);min-height:8px;width:20px;background-repeat:no-repeat no-repeat"></div>
</div></div></div></div><div style="background-color:rgb(242,242,242);padding:0px;margin:0px;width:auto;border-bottom-left-radius:0px;border-bottom-right-radius:0px;background-repeat:initial initial"></div></div>
<div style="clear:both"></div></div><div style="font-size:13px;padding:0px;margin:0px;width:auto;border-bottom-left-radius:0px;border-bottom-right-radius:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:none">
<div style="border-top-width:1px;border-top-style:solid;border-top-color:rgb(216,216,216);padding:12px 0px 0px 8px"><table cellpadding="0" style="border-collapse:collapse;text-align:start;color:rgb(34,34,34);font-size:13px;width:601px;font-family:arial,sans-serif;margin:0px">
<tbody><tr><td style="font-family:arial,sans-serif;margin:0px"></td><td style="font-family:arial,sans-serif;margin:0px"></td><td style="font-family:arial,sans-serif;margin:0px"></td><td style="font-family:arial,sans-serif;margin:0px">
</td><td style="font-family:arial,sans-serif;margin:0px;text-align:right;width:597px;padding-right:4px"></td></tr></tbody></table><br><div style="padding-left:0px;clear:both;color:rgb(34,34,34);font-family:arial,sans-serif;margin:0px;padding-bottom:0px">
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>