<div dir="ltr">Can you try reading your images with vv viewer <a href="http://www.creatis.insa-lyon.fr/rio/vv#Download_VV">http://www.creatis.insa-lyon.fr/rio/vv#Download_VV</a><br><br>it too uses the same vtk and Qt. If it can read properly then go to it src code and find out how they setup the vtkImageViewer2.<br>
<br>HTH<br><br>Jothy<br><br><div class="gmail_quote">On Tue, Jul 26, 2011 at 3:08 PM, Joseph D. Wieber Jr. <span dir="ltr">&lt;<a href="mailto:jdwieber@gmail.com">jdwieber@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  

    
  
  <div bgcolor="#ffffff" text="#000000">
    <br>
    Update:<br>
    <br>
    A colleague of mine pointed out to me that in the header the pixel
    dimensions of the sample image is 0.292.  When we manually change
    this value to 1.0 the image displays at full size.  We tried to
    change that value in the code, but our efforts were fruitless.  We
    tried several alternatives including changing the output spacing,
    reslicing, resampling, and setting the spacing.  Can someone please
    tell me what I have to do to modify the dicom header using vtk and
    have the image display at the full 512x512 pixel resolution? 
    Thanks.<br>
    <br>
    Regards,<br><font color="#888888">
    <br>
    Joseph</font><div><div></div><div class="h5"><br>
    <br>
    <div dir="ltr">
      <div class="gmail_quote">On Sun, Jul 24, 2011 at 8:50 PM, Joseph
        D. Wieber Jr. <span dir="ltr">&lt;<a href="mailto:jdwieber@gmail.com" target="_blank">jdwieber@gmail.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
          <div bgcolor="#ffffff" text="#000000"> <br>
            Hello,<br>
            <br>
            I&#39;m new to VTK and I&#39;m working on a project that reads dicom
            image files.  The files I have are 512x512 pixels, but when
            I view them they display at approx 150x150 pixels.  I&#39;m
            using Qt to create the UI via Qt designer with the
            qvtkWidget.  I&#39;m using the vtkImageViewer2 class to handle
            the visualization.  I pasted my initialization code below. 
            The algorithm I&#39;m working on is intelligent scissors (user
            guided segmentation).  I originally implemented it in
            OpenCV, but need to convert my app. to use VTK.  I need to
            extract pixel locations from left click and mouse over
            events, and I have this part working correctly.  However,
            for the algorithm to work properly I need to do a lookup
            into a cost table based on pixel location.  The cost table
            is built to the correct size (512x512), and when I write out
            the dimensions of the image I see 512x512, but when I do the
            picking I get locations in the range of 0 - 150.  Indeed,
            the displayed image takes up only a small portion of the
            widget (see image below).  I tried searching the web and the
            mailing list, but found nothing.  I&#39;m not sure what search
            terms are appropriate.  I found in the vtkImageViewer2
            documentation that dicom images are scaled by Z coordinate
            of the image slice.  When I print out the position of the
            image the z coord is 0, but I don&#39;t know what (or how to
            get) the position of the camera is.  How can I make the
            visualization pipeline display the image at full size?<br>
            <br>
            Thank you in advance for any help or suggestions.<br>
            <br>
            Regards,<br>
            <br>
            Joseph.<br>
            <br>
            <tt>MainWindow::MainWindow( QWidget *parent, const
              string&amp; fname ) :<br>
                  QMainWindow( parent ),<br>
                  ui( new Ui::MainWindow ),<br>
                  m_fileName( fname )<br>
              {<br>
                  ui-&gt;setupUi( this );<br>
              <br>
                  // Read the image<br>
                  vtkSmartPointer&lt; vtkDICOMImageReader &gt; reader =<br>
                          vtkSmartPointer&lt; vtkDICOMImageReader
              &gt;::New();<br>
                  reader-&gt;SetFileName( m_fileName.c_str () );<br>
                  reader-&gt;Update ();<br>
              <br>
                  // setup the intelligent scissors object<br>
                  //mexican hat LoG<br>
                  double laplacian[] = {  0.,  0., -1.,  0.,  0.,<br>
                                          0., -1., -2., -1.,  0.,<br>
                                         -1., -2., 16., -2., -1.,<br>
                                          0., -1., -2., -1.,  0.,<br>
                                          0.,  0., -1.,  0.,  0. };<br>
              <br>
                  m_spScissors.reset( new IntelligentScissors(
              reader-&gt;GetOutput (),<br>
                                                               laplacian
              ) );<br>
              <br>
                  // Setup the blending function to overlay the
              segmentation contour on the image<br>
                  vtkSmartPointer&lt; vtkImageBlend &gt; blend =<br>
                          vtkSmartPointer&lt; vtkImageBlend &gt;::New();<br>
                  blend-&gt;AddInputConnection(
              reader-&gt;GetOutputPort() );<br>
                  blend-&gt;SetOpacity( 0, 0.6 );<br>
                  blend-&gt;AddInputConnection(
              m_spScissors-&gt;getPathImage () );<br>
                  blend-&gt;SetOpacity( 1, 0.4 );<br>
              <br>
                  vtkSmartPointer&lt; vtkImageViewer2 &gt; viewer =<br>
                          vtkSmartPointer&lt; vtkImageViewer2
              &gt;::New();<br>
                  viewer-&gt;SetInputConnection (
              blend-&gt;GetOutputPort () );<br>
              <br>
                  // make the viewer use the interactor supplied from
              the qvtk widget<br>
                  viewer-&gt;SetupInteractor (
              ui-&gt;qvtkWidget-&gt;GetInteractor () );<br>
              <br>
                  //bind Qt and VTK<br>
                  ui-&gt;qvtkWidget-&gt;SetRenderWindow (
              viewer-&gt;GetRenderWindow () );<br>
              <br>
                  //try to get image displayed at full size<br>
                  viewer-&gt;GetInteractorStyle
              ()-&gt;AutoAdjustCameraClippingRangeOff ();<br>
              <br>
                  // Annotate the image with mouse over pixel
              information<br>
                  vtkSmartPointer&lt; vtkCornerAnnotation &gt;
              cornerAnnotation =<br>
                          vtkSmartPointer&lt; vtkCornerAnnotation
              &gt;::New();<br>
                  cornerAnnotation-&gt;SetLinearFontScaleFactor( 2 );<br>
                  cornerAnnotation-&gt;SetNonlinearFontScaleFactor( 1 );<br>
                  cornerAnnotation-&gt;SetMaximumFontSize( 15 );<br>
                  cornerAnnotation-&gt;SetText( 0, &quot;Off Image&quot; );<br>
                  cornerAnnotation-&gt;SetText( 3,
              &quot;&lt;window&gt;\n&lt;level&gt;&quot; );<br>
                  cornerAnnotation-&gt;GetTextProperty()-&gt;SetColor(
              1, 0, 0 );<br>
                  viewer-&gt;GetRenderer ()-&gt;AddViewProp (
              cornerAnnotation );<br>
              <br>
                  // Picker to pick pixels<br>
                  vtkSmartPointer&lt; vtkPropPicker &gt; propPicker =<br>
                          vtkSmartPointer&lt; vtkPropPicker &gt;::New();<br>
                  propPicker-&gt;PickFromListOn();<br>
              <br>
                  // Give the picker a prop to pick<br>
                  vtkImageActor* imageActor =
              viewer-&gt;GetImageActor();<br>
                  propPicker-&gt;AddPickList( imageActor );<br>
              <br>
                  // disable interpolation, so we can see each pixel<br>
                  imageActor-&gt;InterpolateOff();<br>
              <br>
                  // Set callback functions<br>
                  vtkInteractorStyleImage* imageStyle =
              viewer-&gt;GetInteractorStyle();<br>
              <br>
                  //listen to MouseMoveEvents invoked by the
              interactor&#39;s style<br>
                  OnMouseMovePtr onMouseMove = OnMouseMovePtr::New();<br>
                  onMouseMove-&gt;SetViewer( viewer );<br>
                  onMouseMove-&gt;SetAnnotation( cornerAnnotation );<br>
                  onMouseMove-&gt;SetPicker( propPicker );<br>
                  onMouseMove-&gt;SetIntelligentScissors ( m_spScissors
              );<br>
                  imageStyle-&gt;AddObserver(
              vtkCommand::MouseMoveEvent, onMouseMove );<br>
              <br>
                  //listen to LeftButtonPressEvent invoked by the
              interactor&#39;s style<br>
                  OnLeftClickPtr onLeftClick = OnLeftClickPtr::New ();<br>
                  onLeftClick-&gt;SetViewer ( viewer );<br>
                  onLeftClick-&gt;SetAnnotation ( cornerAnnotation );<br>
                  onLeftClick-&gt;SetPicker ( propPicker );<br>
                  onLeftClick-&gt;SetIntelligentScissors ( m_spScissors
              );<br>
                  imageStyle-&gt;AddObserver (
              vtkCommand::LeftButtonPressEvent, onLeftClick );<br>
              <br>
                  viewer-&gt;Render ();<br>
              }</tt><br>
            <br>
            <br>
            <img alt="View in HTML to see image" src="cid:part1.03090207.09050607@gmail.com" height="707" width="684"><br>
          </div>
          <br>
          _______________________________________________<br>
          Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
          <br>
          Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
          <br>
          Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
          <br>
          Follow this link to subscribe/unsubscribe:<br>
          <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
          <br>
        </blockquote>
      </div>
      <br>
    </div>
  </div></div></div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>