DICOMSR - How to convert frame list to std::vector<int>?
Moderator: Moderator Team
-
- Posts: 28
- Joined: Mon, 2016-05-09, 08:32
DICOMSR - How to convert frame list to std::vector<int>?
I'm using dcmtk 3.6.0 library.
My input: DICOMSR file that be referenced to multi-frame image.
Based on dcmtk library, I can get frame list by using the following statement : ((DSRImageTreeNode *)node)->getFrameList().
It returns to the DSRImageFrameList type.
How to convert to std::vector<int> type ?
Sorry if my English not good!
Thanks for seeing!
My input: DICOMSR file that be referenced to multi-frame image.
Based on dcmtk library, I can get frame list by using the following statement : ((DSRImageTreeNode *)node)->getFrameList().
It returns to the DSRImageFrameList type.
How to convert to std::vector<int> type ?
Sorry if my English not good!
Thanks for seeing!
-
- DCMTK Developer
- Posts: 2504
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: DICOMSR - How to convert frame list to std::vector<int>?
Such a method is still on my to-do list, so in the meantime you have to implement it on your own (by iterating over the elements of the frame list...).Based on dcmtk library, I can get frame list by using the following statement : ((DSRImageTreeNode *)node)->getFrameList().
It returns to the DSRImageFrameList type.
How to convert to std::vector<int> type ?
-
- Posts: 28
- Joined: Mon, 2016-05-09, 08:32
Re: DICOMSR - How to convert frame list to std::vector<int>?
I'm using VisualStudio 2013.J. Riesmeier wrote:Such a method is still on my to-do list, so in the meantime you have to implement it on your own (by iterating over the elements of the frame list...).Based on dcmtk library, I can get frame list by using the following statement : ((DSRImageTreeNode *)node)->getFrameList().
It returns to the DSRImageFrameList type.
How to convert to std::vector<int> type ?
I have tried using the following code, but failed:
Code: Select all
std::vector<int> vtFrameList;
auto frameList = imageNode->getFrameList(); // get frame list. Return to the DSRImageFrameList type.
size_t count = 0;
while (count < frameList.getNumberOfItems())
{
auto item = frameList.getItem(count++);
int value = OFstatic_cast(Sint32, item);
vtFrameList.push_back(value);
}
"Error 118 error LNK2001: unresolved external symbol "public: static long const DSRListOfItems<long>::EmptyItem" (?EmptyItem@?$DSRListOfItems@J@@2JB)"
Last edited by kstn_hut_hat on Mon, 2016-05-09, 09:56, edited 1 time in total.
-
- DCMTK Developer
- Posts: 2504
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: DICOMSR - How to convert frame list to std::vector<int>?
Not sure whether your first "auto" statement is actually correct. I would rather use "DSRImageFrameList &" (by-refence) instead.
By the way, the reason why no std::vector is used internally for the frame list is quite simple: the implementation of the "dcmsr" module started back in the year 2000. And at that time support for the vector class was quite limited (if I remember correctly). That's also the reason why we have alternative implementations in "ofstd".
By the way, the reason why no std::vector is used internally for the frame list is quite simple: the implementation of the "dcmsr" module started back in the year 2000. And at that time support for the vector class was quite limited (if I remember correctly). That's also the reason why we have alternative implementations in "ofstd".
-
- Posts: 28
- Joined: Mon, 2016-05-09, 08:32
Re: DICOMSR - How to convert frame list to std::vector<int>?
I have changed from "auto" to "DSRImageFrameList &" but not success. Is there any other way?
Thanks for your reply!
Thanks for your reply!
-
- DCMTK Developer
- Posts: 2504
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: DICOMSR - How to convert frame list to std::vector<int>?
I checked your sample code with gcc 4.8.4 (Linux x86_64)... and it works. So, it seems to be an issue with your compiler/linker or with your project-specific settings.
-
- Posts: 10
- Joined: Tue, 2020-03-31, 09:12
Re: DICOMSR - How to convert frame list to std::vector<int>?
Hi,kstn_hut_hat wrote: ↑Mon, 2016-05-09, 09:34I'm using VisualStudio 2013.J. Riesmeier wrote:Such a method is still on my to-do list, so in the meantime you have to implement it on your own (by iterating over the elements of the frame list...).Based on dcmtk library, I can get frame list by using the following statement : ((DSRImageTreeNode *)node)->getFrameList().
It returns to the DSRImageFrameList type.
How to convert to std::vector<int> type ?
I have tried using the following code, but failed:When build it, have an error:Code: Select all
std::vector<int> vtFrameList; auto frameList = imageNode->getFrameList(); // get frame list. Return to the DSRImageFrameList type. size_t count = 0; while (count < frameList.getNumberOfItems()) { auto item = frameList.getItem(count++); int value = OFstatic_cast(Sint32, item); vtFrameList.push_back(value); }
"Error 118 error LNK2001: unresolved external symbol "public: static long const DSRListOfItems<long>::EmptyItem" (?EmptyItem@?$DSRListOfItems@J@@2JB)"
Did u found any soluion for above error. I am looking solution for this now.
-
- DCMTK Developer
- Posts: 2504
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: DICOMSR - How to convert frame list to std::vector<int>?
Which version of the DCMTK do you use and which version of Visual Studio?
-
- Posts: 10
- Joined: Tue, 2020-03-31, 09:12
Re: DICOMSR - How to convert frame list to std::vector<int>?
visual studio 2013 and Dcmtk -3.6.0
-
- DCMTK Developer
- Posts: 2504
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: DICOMSR - How to convert frame list to std::vector<int>?
DCMTK 3.6.0 is more than 9 years old. Please try again with a more recent version, e.g. 3.6.5 from October 2019.
-
- DCMTK Developer
- Posts: 2504
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: DICOMSR - How to convert frame list to std::vector<int>?
By the way, the base class of DSRImageFrameList, i.e. DSRListOfItems<T>, now also offers a getItems(OFVector<T> &items) method. This answers the original question "How to convert to std::vector<int> type?"
-
- Posts: 10
- Joined: Tue, 2020-03-31, 09:12
Re: DICOMSR - How to convert frame list to std::vector<int>?
okay will update and check . thanks for your responseJ. Riesmeier wrote: ↑Wed, 2020-04-01, 12:20 DCMTK 3.6.0 is more than 9 years old. Please try again with a more recent version, e.g. 3.6.5 from October 2019.
Who is online
Users browsing this forum: Google [Bot] and 1 guest