<div dir="ltr">Hi,<div><div>This is the code i used for image viewer with vtkResliceImageViewer, is this ok? </div><div>as per vtk class reference doc, the vtkResliceImageViewer will behave like <span style="color:windowtext;text-decoration-line:none"><a href="https://www.vtk.org/doc/nightly/html/classvtkImageViewer2.html" title="Display a 2D image." style="cursor: pointer;">vtkImageViewer2</a>, </span><span style="color:rgb(0,0,0);font-family:Roboto,sans-serif;font-size:14px"> if the Reslice mode is set to RESLICE_AXIS_ALIGNED, </span></div><div><font color="#000000" face="Roboto, sans-serif"><span style="font-size:14px">but the setting not affecting in image display.  </span></font></div><div><br></div><div>viewwidget::viewwidget(QWidget *parent) : QWidget(parent)</div><div>{</div><div><br></div><div>     QPointer<QVTKWidget> m_vtkWgt      = new QVTKWidget(this);</div><div><br></div><div>    vtkSmartPointer<vtkResliceImageViewer> m_vtkImViewer   = vtkSmartPointer<vtkResliceImageViewer>::New();</div><div><br></div><div>     QPointer<QHBoxLayout> m_loSinWin      = new QHBoxLayout(this);</div><div><br></div><div>    vtkSmartPointer<vtkDICOMReader> m_vtkDcmRdr m_vtkDcmRdr     = vtkSmartPointer<vtkDICOMReader>::New();</div><div><br></div><div>    m_MetaData      = vtkSmartPointer<vtkDICOMMetaData>::New();</div><div><br></div><div>    m_loSinWin->addWidget(m_vtkWgt);</div><div>    this->setLayout(m_loSinWin);</div><div><br></div><div>    vtkSmartPointer <vtkDICOMDirectory> vtkDcmDir = vtkSmartPointer<vtkDICOMDirectory>::New();</div><div><br></div><div>    vtkSmartPointer <vtkStringArray>  aVtkStrFNames;</div><div><br></div><div>    QString imgFolder = QDir::currentPath()+"/sampledicom/MRIX_LUMBAR/Lumbar/3-PlaneLoc1";</div><div>    vtkDcmDir->SetDirectoryName(imgFolder.toStdString().c_str());</div><div>    vtkDcmDir->RequirePixelDataOn();</div><div>    vtkDcmDir->Update();</div><div>     // Iterate through all of the studies that are present.</div><div>    int iNoStudies = vtkDcmDir ->GetNumberOfStudies();</div><div>    for(int i = 0; i < iNoStudies; i++)</div><div>    {</div><div>        // Get information related to the patient study</div><div>        //vtkDICOMItem   patient = dicomdir ->GetPatientRecordForStudy(i);</div><div>        //vtkDICOMItem   study = dicomdir ->GetStudyRecord(i);</div><div>        // Iterate through all of the series in this study.</div><div>        int j1 = vtkDcmDir ->GetFirstSeriesForStudy(i);</div><div>        int j2 = vtkDcmDir ->GetLastSeriesForStudy(i);</div><div>        for (int j = j1; j <= j2; j++)</div><div>        {</div><div>            aVtkStrFNames = vtkDcmDir->GetFileNamesForSeries(j);</div><div>            // do something with the files</div><div>            m_vtkDcmRdr ->SetFileNames(aVtkStrFNames);</div><div>            m_vtkDcmRdr->UpdateInformation();</div><div>            m_vtkDcmRdr ->Update();</div><div>        }</div><div>    }</div><div>    //m_vtkDcmRdr->SetMemoryRowOrderToFileNative();</div><div>    m_vtkImViewer->SetSliceOrientationToXY();</div><div>    m_vtkImViewer->SetResliceModeToAxisAligned();</div><div>    m_vtkDcmRdr->Update();</div><div>    m_MetaData = m_vtkDcmRdr->GetMetaData();</div><div>    //m_vtkImViewer->SetInputConnection(m_vtkDcmRdr->GetOutputPort());</div><div><br></div><div>    m_vtkImViewer->SetInputData(m_vtkDcmRdr->GetOutput());</div><div><br></div><div><br></div><div>    m_vtkImViewer->SetRenderWindow(m_vtkWgt->GetRenderWindow());</div><div><br></div><div>    </div><div>    double dDefaultWinWidth   = m_MetaData->GetAttributeValue (0 , DC :: WindowWidth ). AsDouble () ;</div><div><br></div><div>    double dDefaultWinLevel   = m_MetaData-> GetAttributeValue(0 , DC :: WindowCenter ). AsDouble () ;</div><div><br></div><div>    m_vtkImViewer->SetColorLevel(dDefaultWinWidth);</div><div>    m_vtkImViewer->SetColorWindow(dDefaultWinLevel);</div><div><br></div><div><br></div><div>    m_vtkImViewer->SetupInteractor(m_vtkWgt->GetInteractor());</div><div><br></div><div>    m_vtkImViewer->GetRenderer()->ResetCamera();</div><div>    m_vtkImViewer->Render();</div><div>    m_vtkWgt->GetInteractor()->Initialize();</div><div>    m_vtkWgt->show();</div><div>}</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 20, 2017 at 9:14 PM, K O ranjith <span dir="ltr"><<a href="mailto:kor1581@gmail.com" target="_blank">kor1581@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 dir="ltr"><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">Hello,</span><span style="font-size:12pt;font-family:"Times New Roman",serif"><span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">Thanks for the
support.<span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">As I mentioned in my
question I have tried to set the window level and width from the dicom metadata
to both the viewer’s using the api s<span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">    m_vtkImViewer->SetColorLevel(<wbr>dDefaultWinWidth);<span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">    m_vtkImViewer->SetColorWindow(<wbr>dDefaultWinLevel);<span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">but the result from
vtkResliceImageViewer is different than other viewers, ie vtkImageViewer2 and
other dicom viewer applications.<span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif"><span> </span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">While connecting the vtkResliceImageViewer</span>
with vtkDICOMReader with api “SetInputData””, have .<span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif"><span> </span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">So I tried with the
method vtkResliceImageViewer</span>-><wbr>SetInputConnection(vtkDICOMRea<wbr>der ->GetOutputPort());,  then vtk showing error message "Use
SetInputData instead.", but the images are displaying image almost
same as (but not exact )other viewers. But then also, while setting the window
level and width from to the default value in the dicom metadata, the image
display again getting distorted. But the vtkImageViewer2 have same
proper result all the time.<span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">I used 2d dicom images
for testing.<span></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal">





















</p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:Arial,sans-serif">Why this happening? What
are the basic difference in both vtk viewers in displaying images and setting window
level and width?<span></span></span></p><div><pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 20, 2017 at 6:23 PM, Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="m_6437989850229295421m_1624349228466485365markdown-here-wrapper" style="font-family:"Lucida Sans",Cantarell,Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">The difference in the two images seems to be window width and level. Ensure that the values are same in the vtkImageResliceViewer.</p>
<div title="MDH:VGhlIGRpZmZlcmVuY2UgaW4gdGhlIHR3byBpbWFnZXMgc2VlbXMgdG8gYmUgd2luZG93IHdpZHRo
IGFuZCBsZXZlbC4gRW5zdXJlIHRoYXQgdGhlIHZhbHVlcyBhcmUgc2FtZSBpbiB0aGUgdnRrSW1h
Z2VSZXNsaWNlVmlld2VyLg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><br><div class="gmail_quote"><div><div class="m_6437989850229295421h5"><div dir="ltr">On Wed, Sep 20, 2017 at 7:37 AM K O ranjith <<a href="mailto:kor1581@gmail.com" target="_blank">kor1581@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_6437989850229295421h5"><div dir="ltr">Hello,<div>While displaying same dicom images in vtkResliceImageViewer and vtkImageViewer2, it showing images with a different window level and window width.</div><div>I also tried to get the window level and window width values from dicom metadata and set in both the viewers. Then the vtkImageViewer2 giving same result as like other dicom viewer applications(like RadiAnt), but vtkResliceImageViewer showing a differnt result from others.</div><div>I need to use vtkResliceImageViewer in my application.</div><div>why images displaying in different manner in vtkResliceImageViewer and vtkImageViewer2?<br>Can get the same result with vtkResliceImageViewer as like vtkImageViewer2? </div><div>Do need to perform any configuration in vtkResliceImageViewer?</div><div><br></div><div>(Attached the screenshot of screens displayed same dicom image with vtkResliceImageViewer and vtkImageViewer2)</div><div><br></div></div></div></div>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/vtkusers</a><span class="m_6437989850229295421HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><span class="m_6437989850229295421HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div class="m_6437989850229295421m_1624349228466485365gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="m_6437989850229295421m_1624349228466485365inbox-markdown-here-wrapper" style="font-family:'proza libre',sans-serif;color:rgb(0,56,107)"><h5 id="m_6437989850229295421m_1624349228466485365inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="m_6437989850229295421m_1624349228466485365inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:'open sans',sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/" target="_blank">Kitware</a> | (518) 881-4417</h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></div>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>