<div>Hello Yoshimi,</div><div>Thank you so much, it works!</div><div><br></div><div>Regards,</div><div>Yirui</div><div><div><br></div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "kenichiro yoshimi"<rccm.kyoshimi@gmail.com>;</div><div><b>发送时间:</b> 2018年7月21日(星期六) 晚上10:39</div><div><b>收件人:</b> "yirui1210"<523480317@qq.com>;<wbr></div><div><b>抄送:</b> "vtkusers"<vtkusers@public.kitware.com>; <wbr></div><div><b>主题:</b> Re: [vtkusers] Data cannot transfer between different dll when linkVTK in static mode</div></div><div><br></div>Hello Yirui,<br><br>I think the problem is caused by the missing information relating to<br>the pipeline and hence WHOLE_EXTENT. Therefore in Function2WriteImage<br>function, you need to explicitly create vtkTrivialProducer to pass the<br>WHOLE_EXTENT to the writer below.<br><br>void Function2WriteImage(vtkSmartPointer<vtkImageData> data)<br>{<br>  int ext[6];<br>  data->GetExtent(ext);<br>  vtkSmartPointer<vtkTrivialProducer> producer =<br>    vtkSmartPointer<vtkTrivialProducer>::New();<br>  producer->SetOutput(data);<br>  producer->SetWholeExtent(ext);<br><br>  std::cout << "Write image using function2.dll" << std::endl;<br>  vtkSmartPointer<vtkMetaImageWriter> writer =<br>    vtkSmartPointer<vtkMetaImageWriter>::New();<br>  writer->SetFileName("./function2_write_image.mha");<br>  writer->SetInputConnection(producer->GetOutputPort());<br>  try {<br>    writer->Write();<br>  }<br>  catch (...)<br>  {<br>    std::cout << "function 2 write image error." << std::endl;<br>    return;<br>  }<br>}<br><br>Regards<br>2018年7月21日(土) 17:16 yirui1210 <523480317@qq.com>:<br>><br>> Hello,<br>><br>> I build VTK 8.0 in static mode in Windows 10, VS2015, and I write a simple demo which has two dll modules. The data is transferred as following:<br>> (1) read data in module 1 and save it, this is no problem.<br>> (2) transfer the data in module 1 to module 2.<br>> (3) write the data in module 2, but there is error, the saved data is empty.<br>> I have traced the code in VTK roughly, the image extent is [0, -1, 0, -1, 0, -1], but I can retrieve the pixel, the pixel value can be get correctly. The demo code I used is attached in this email, any help or tips will be appreciated, thank you!<br>><br>> Regards,<br>> Yirui<br>> _______________________________________________<br>> Powered by www.kitware.com<br>><br>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br>><br>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br>><br>> Search the list archives at: http://markmail.org/search/?q=vtkusers<br>><br>> Follow this link to subscribe/unsubscribe:<br>> https://public.kitware.com/mailman/listinfo/vtkusers<br></div>