<div dir="ltr"><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Marco Dev</b> <span dir="ltr"><<a href="mailto:marco.dev.open@gmail.com">marco.dev.open@gmail.com</a>></span><br>Date: Mon, Aug 17, 2015 at 7:14 AM<br>Subject: vtk transform filter on .RAW<br>To: ITK <<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>><br><br><br><div dir="ltr">Hi,<div>why does not work vtk transform filter correctly on .RAW file </div><div>I read the .raw file through ifstream then create a image type from this buffer as follow bellow:</div><div><br></div><div>ifstream fin(filePath[0], ios::in | ios::binary);</div><div><br></div><div><span style="white-space:pre-wrap">           </span>signed short iSample;</div><div><br></div><div><span style="white-space:pre-wrap">           </span>cout << "Samples Output" << endl;</div><div><span style="white-space:pre-wrap">          </span>while (fin.read((char *)&iSample, sizeof(signed short)))</div><div><span style="white-space:pre-wrap">             </span>{</div><div><br></div><div><span style="white-space:pre-wrap">               </span>m_Short.push_back(iSample);</div><div><br></div><div><span style="white-space:pre-wrap">             </span>}</div><div><br></div><div><span style="white-space:pre-wrap">               </span>cout << " size of short vector " << m_Short.size();</div><div><br></div><div><br></div><div><span style="white-space:pre-wrap">              </span>m_Aloc = (signed short*)malloc(m_Short.size() * 2);</div><div><span style="white-space:pre-wrap">              </span>int counter = 0;</div><div><span style="white-space:pre-wrap">         </span>for (std::vector<signed short>::iterator it = m_Short.begin(); it != m_Short.end(); ++it, counter++){</div><div><br></div><div><span style="white-space:pre-wrap">             </span>m_Aloc[counter] = (*it);</div><div><br></div><div><br></div><div><span style="white-space:pre-wrap">               </span>} </div><div><br></div><div>.</div><div>. // set nidex size orientation spacing  ,,,,, to itk filter </div><div>.</div><div>.</div><div><div><span style="white-space:pre-wrap">            </span>importFilter->SetImportPointer(m_Aloc,sizeX*sizeY*sizeZ, true);</div><div><span style="white-space:pre-wrap">       </span></div><div><br></div><div><span style="white-space:pre-wrap">                </span>try</div><div><span style="white-space:pre-wrap">              </span>{</div><div><span style="white-space:pre-wrap">                </span>importFilter->Update();</div><div><span style="white-space:pre-wrap">               </span>pVol = importFilter->GetOutput();</div><div><span style="white-space:pre-wrap">             </span>}</div><div><span style="white-space:pre-wrap">                </span>catch (itk::ExceptionObject & err)</div><div><span style="white-space:pre-wrap">           </span>{</div><div><span style="white-space:pre-wrap">                </span>return false;</div><div><span style="white-space:pre-wrap">            </span>}</div><div><span style="white-space:pre-wrap">                </span>pVol->Register();</div></div><div><br></div><div><div><br></div><div><span style="white-space:pre-wrap">    </span>typedef itk::ImageToVTKImageFilter<ImageType> itkVtkConverter;</div><div><span style="white-space:pre-wrap">     </span>itkVtkConverter::Pointer conv = itkVtkConverter::New();</div><div><br></div><div><span style="white-space:pre-wrap"> </span>conv->SetInput(pVol);</div><div><span style="white-space:pre-wrap"> </span>conv->Update();</div><div><br></div><div><span style="white-space:pre-wrap">      </span>vtkSmartPointer<vtkImageData> vtkImage = vtkSmartPointer<vtkImageData>::New();</div><div><span style="white-space:pre-wrap">       </span>vtkImage->ShallowCopy(conv->GetOutput());</div><div><span style="white-space:pre-wrap">  </span>//shallow copy is vtk's equivalent of disconnect pipeline</div><div><br></div><div><span style="white-space:pre-wrap">   </span>volumeRayCatMapper = vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>::New();</div><div><br></div><div><br></div><div><span style="white-space:pre-wrap">   </span>volumeRayCatMapper->SetInputData(vtkImage);</div></div><div>.</div><div>.</div><div>.</div><div>.</div><div><div><span style="white-space:pre-wrap">    </span>//Skin</div><div><span style="white-space:pre-wrap">   </span></div><div><span style="white-space:pre-wrap"> </span>color->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);</div><div><span style="white-space:pre-wrap"> </span>color->AddRGBPoint(-1000, .62, .36, .18, 0.5, 0.0);</div><div><span style="white-space:pre-wrap">   </span>color->AddRGBPoint(-500, .88, .60, .29, 0.33, 0.45);</div><div><span style="white-space:pre-wrap">  </span>color->AddRGBPoint(3071, .83, .66, 1, 0.5, 0.0);</div><div><br></div><div><span style="white-space:pre-wrap">     </span>compositeOpacity->AddPoint(-3024, 0, 0.5, 0.0);</div><div><span style="white-space:pre-wrap">       </span>compositeOpacity->AddPoint(-1000, 0, 0.5, 0.0);</div><div><span style="white-space:pre-wrap">       </span>compositeOpacity->AddPoint(-500, 1.0, 0.33, 0.45);</div><div><span style="white-space:pre-wrap">    </span>compositeOpacity->AddPoint(3071, 1.0, 0.5, 0.0);</div><div><br></div><div><span style="white-space:pre-wrap">     </span>volumeRayCatMapper->SetBlendModeToComposite();</div><div><span style="white-space:pre-wrap">        </span>volumeProperty->ShadeOn();</div><div><span style="white-space:pre-wrap">    </span>volumeProperty->SetAmbient(0.1);</div><div><span style="white-space:pre-wrap">      </span>volumeProperty->SetDiffuse(0.9);</div><div><span style="white-space:pre-wrap">      </span>volumeProperty->SetSpecular(0.2);</div><div><span style="white-space:pre-wrap">     </span>volumeProperty->SetSpecularPower(10.0);</div><div><span style="white-space:pre-wrap">       </span>volumeProperty->SetScalarOpacityUnitDistance(0.8919);</div><div><span style="white-space:pre-wrap"> </span></div></div><div><br></div><div>why does not work correctly on volume ?</div><div>if I read the dicom series from itk reader it does work correctly </div><div><br></div><div>Thanks</div></div>
</div><br></div>