that was the problem!
thank you!
sebastian
On 29/07/2015 02:28 a.m., Sascha Zelzer wrote:
> Hi,
>
> if your stl file is binary encoded, you would need to tell this fact
> the IOUtil::Load method (by providing the "std::ios::binary |
> std::ios::in" open flags, just like you would when using regular std
> streams). I can"t think of any other issue here.
>
> Best,
> Sascha
>
> On 07/28/2015 11:45 PM, Sebastian Ordas wrote:
>> thank you Sascha,
>>
>> It looks like the problem is somewhere else: the resource is correctly
>> loaded, I guess, but:
>>
>> std::vector<mitk::BaseData::Pointer> data =
>> mitk::IOUtil::Load(resource);
>> mitk::Surface::Pointer fileoutput =
>> dynamic_cast<mitk::Surface*>(data[0].GetPointer());
>> vtkPolyData* pd = fileoutput->GetVtkPolyData();
>>
>> retrieves wrong data: 32409 points instead of the correct number, 5421
>> (retrieved via vtkSTLReader)
>>
>> Let me add that the file opens correctly via File->Open File
>>
>> so the problem should be in the resource version of
>> mitk::IOUtil::Load(), right?
>>
>> thanks
>> sebastian
>>
>> On 28/07/2015 02:06 p.m., Sascha Zelzer wrote:
>>> Hi,
>>>
>>> the Module::GetResource() method will make the resources of the module
>>> object you call that method with accessible. It does not search across
>>> modules. My guess is you are trying to retrieve the "body.stl"
>>> resource from your own module, not from the QtWidgets module.
>>>
>>> Cheers,
>>> Sascha
>>>
>>> On 07/28/2015 04:28 AM, Sebastian Ordas wrote:
>>>> Hi Team,
>>>>
>>>> How can I load an .stl resource file in a class located in QtWidgets
>>>> module? (QmitkStdMultiWidget.cpp)
>>>> 1) My STL file, "body.stl" is located in
>>>> D:\sources\MITK\Modules\QtWidgets\resource (note, there is no
>>>> "resources" folder)
>>>> 2) It is not listed in Qmitk.qrc
>>>> 3) but it is indicated in
>>>> D:\sources\MITK\Modules\QtWidgets\files.cmake as:
>>>>
>>>> ...
>>>>
>>>> set(QRC_FILES
>>>> resource/Qmitk.qrc
>>>> )
>>>>
>>>> set(RESOURCE_FILES
>>>> body.stl
>>>> )
>>>>
>>>> 4) finally, in the code:
>>>>
>>>> us::Module* module = us::GetModuleContext()->GetModule();
>>>> us::ModuleResource resource = module->GetResource("body.stl");
>>>> std::vector<mitk::BaseData::Pointer> data =
>>>> mitk::IOUtil::Load(resource);
>>>>
>>>> if(!data.empty())
>>>> {
>>>> mitk::Surface::Pointer fileoutput =
>>>> dynamic_cast<mitk::Surface*>(data[0].GetPointer());
>>>> if (fileoutput->GetVtkPolyData())
>>>> ...
>>>> }
>>>>
>>>> thank you for any hint,
>>>> sebastian
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> mitk-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users