<div dir="ltr">Has anyone tested this bug?<div><br></div><div>Thanks!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 4:22 PM, Mengda Wu <span dir="ltr"><<a href="mailto:wumengda@gmail.com" target="_blank">wumengda@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">Hi Vtkusers,<div><br></div><div>  I found a bug in vtkImageMapToColors. It does not output with input spacing and origin. It sets the spacing to [1,1,1] and origin to [0,0,0]. I am using VTK 6.2 but I believe it happens also in VTK 7.0. Can you fix this? Here is a test program and a sample image (input.mha) and its output(input-colormap.mha):</div><div><br></div><div>   <span style="white-space:pre-wrap">   </span>vtkSmartPointer<vtkMetaImageReader> inputReader = vtkSmartPointer<vtkMetaImageReader>::New();</div><div><span style="white-space:pre-wrap">        </span>inputReader->SetFileName(argv[1]);</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>inputReader->Update();</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>catch(...)</div><div><span style="white-space:pre-wrap">       </span>{</div><div><span style="white-space:pre-wrap">                </span>std::cerr << "Error occurs when reading " << argv[1] << std::endl;</div><div><span style="white-space:pre-wrap">           </span>return EXIT_FAILURE;</div><div><span style="white-space:pre-wrap">     </span>}</div><div><br></div><div><span style="white-space:pre-wrap">       </span>vtkSmartPointer<vtkLookupTable> lookupTable = vtkSmartPointer<vtkLookupTable>::New();</div><div><span style="white-space:pre-wrap">        </span>lookupTable->SetTableRange(0.0, 255.0);</div><div><span style="white-space:pre-wrap">       </span>lookupTable->SetNumberOfTableValues(256);</div><div><span style="white-space:pre-wrap">     </span>lookupTable->SetTableValue(0, 0.0, 0.0, 0.0, 0.0);</div><div><span style="white-space:pre-wrap">    </span>for(vtkIdType i=1; i<256; i++)</div><div><span style="white-space:pre-wrap">                </span>lookupTable->SetTableValue(i, 1.0, 0.0, 0.0, 0.4);</div><div><span style="white-space:pre-wrap">    </span>lookupTable->Build();</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkImageMapToColors> imageColor = vtkSmartPointer<vtkImageMapToColors>::New();</div><div><span style="white-space:pre-wrap">       </span>imageColor->SetInputConnection(inputReader->GetOutputPort());</div><div><span style="white-space:pre-wrap">      </span>imageColor->SetOutputFormatToRGBA();</div><div><span style="white-space:pre-wrap">  </span>imageColor->SetLookupTable(lookupTable);</div><div><br></div><div><span style="white-space:pre-wrap">     </span>vtkSmartPointer< vtkMetaImageWriter > writer = vtkSmartPointer< vtkMetaImageWriter >::New();</div><div><span style="white-space:pre-wrap"> </span>writer->SetFileName(argv[2]);</div><div><span style="white-space:pre-wrap"> </span>writer->SetInputConnection(imageColor->GetOutputPort());</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>writer->Write();</div><div><span style="white-space:pre-wrap">      </span>}</div><div><span style="white-space:pre-wrap">        </span>catch(...)</div><div><span style="white-space:pre-wrap">       </span>{</div><div><span style="white-space:pre-wrap">                </span>std::cerr << "Error occurs when writing " << argv[2] << std::endl;</div><div><span style="white-space:pre-wrap">           </span>return EXIT_FAILURE;</div><div><span style="white-space:pre-wrap">     </span>}</div><div><br></div><div>Thanks,</div><div>Mengda</div></div>
</blockquote></div><br></div>