<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello David,</div><div><br></div><div>thank you for your great help, the solution you provided above solved my question.</div><div><br></div><div>Best Regards</div><div>James</div><br><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><br>At 2017-03-01 23:57:41, "David Gobbi" <david.gobbi@gmail.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div dir="ltr">And I'd better fix my typo in the code. The last line should be this:<div><br></div><div><span style="font-size:12.8px">fileArray->GetValue(</span><wbr style="font-size:12.8px"></wbr><span style="font-size:12.8px">filesInStack->GetValue(fileNumber)).c_</span><wbr style="font-size:12.8px"></wbr><span style="font-size:12.8px">str()</span><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 8:55 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@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">Yes, there is a roundabout way that you can do this, because the reader can sort the files into stacks.<div><br></div><div><span class=""><div style="font-size:12.8px"> vtkSmartPointer<vtkDICOMReader<wbr></wbr>> reader = vtkSmartPointer<vtkDICOMReader<wbr></wbr>>::New();</div></span><div style="font-size:12.8px"> reader->SetFileNames(<wbr></wbr>fileArray);</div><span class=""><div style="font-size:12.8px"> reader->UpdateInformation();</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> vtkStringArray *stacks = reader->GetStackIDs();</div><div style="font-size:12.8px"> int numberOfStacks = stacks->GetNumberOfValues();</div></span><div style="font-size:12.8px"> int stackNumber = 1; // for example</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> reader->SetDesiredStackID(stac<wbr></wbr>ks->GetValue(stackNumber));</div><div style="font-size:12.8px"> reader->UpdateInformation();</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> <span style="font-size:12.8px">vtkIntArray *filesInStack = reader->GetFileIndexArray();</span></div><div style="font-size:12.8px"> for (int fileNumber = 0; fileNumber < filesInStack-><wbr></wbr>GetNumberOfValues(); fileNumber++)</div><div style="font-size:12.8px"> {</div><div style="font-size:12.8px"> std::cout << fileArray->GetValue(<wbr></wbr>filesInStack->GetValue(jj)).c_<wbr></wbr>str() << std::endl;</div><div style="font-size:12.8px"> }</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">So this code will use the FileIndexArray() to get a sorted list of the files in the stack. Once you have the files you want, you can throw away the reader. Note that I only call UpdateInformation() on the reader, so it is only reading the file headers.</div><span class="HOEnZb"><font color="#888888"><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> - David</div></font></span><div><div class="h5"><div style="font-size:12.8px"><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 7:54 AM, chenjianyyzz <span dir="ltr"><<a href="mailto:chenjianyyzz@163.com" target="_blank">chenjianyyzz@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:arial"><div>Hello David, </div><div><br></div><div>greak, thank you very much. further question: in the attached files there are 2 stacks, and now I want to find which DICOM files belongs to stack0, and which belongs stack1, how can I find it?</div><div>is there any function that I can get the files list for stack0, just like how I get the file list for somes series?</div><div> vtkStringArray *seriesFilenames = sorter->GetFileNamesForSeries(<wbr></wbr>i);</div><div><br></div><div><br></div><div>Best Regards</div><div>James</div><div><div class="m_-8003454190795948419gmail-m_3545564098429442224h5"><br><br><br><br><div style="zoom:1"></div><div id="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184divNeteaseMailCard"></div><br>At 2017-03-01 21:45:47, "David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<br> <blockquote id="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184isReplyContent" style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)"><div dir="ltr">Hi James,<div><br></div><div>All of the images in that zip file have the same SeriesInstanceUID. So this is, in fact, a single series that contains two stacks. This is fairly common.</div><div><br></div><div>The vtkDICOMReader can be used to find the number of stacks:</div><div><br></div><div><div> vtkSmartPointer<vtkDICOMReader<wbr></wbr>> reader = vtkSmartPointer<vtkDICOMReader<wbr></wbr>>::New();</div></div><div> reader->SetFileNames(sorter->G<wbr></wbr>etFileNamesForSeries(0));</div><div> reader->UpdateInformation();</div><div> vtkStringArray *stacks = reader->GetStackIDs();</div><div> int numberOfStacks = stacks->GetNumberOfValues();</div><div><br></div><div>The reader can also be told which stack to read:</div><div><br></div><div> reader->SetDesiredStackID(stac<wbr></wbr>ks->GetValue(0));</div><div> reader->Update();</div><div><br></div><div>With the "Enhanced MR Image IOD" and the "Enhanced CT Image IOD", it is even possible for a single _file_ to contain multiple stacks.</div><div><br></div><div> - David</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 3:50 AM, chenjianyyzz <span dir="ltr"><<a href="mailto:chenjianyyzz@163.com" target="_blank">chenjianyyzz@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:arial"><div>Hello David,</div><div><br></div><div>I have a set of images (it includes 2 series), but the vtkDICOMFileSorter can only 1 series? </div><div>I don't know what's the problem, will any body help me out?</div><div><br></div><div>attached please find the data, and below is the code:</div><div>==============================<wbr></wbr>==========================</div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkStringArray<wbr></wbr>> filenames = vtkSmartPointer<vtkStringArray<wbr></wbr>>::New();</div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0325.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0326.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0327.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0328.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0329.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0330.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0331.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0332.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0333.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0334.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr></wbr>10_0001_0335.dcm"); </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>vtkSmartPointer <vtkDICOMFileSorter> sorter = vtkSmartPointer <vtkDICOMFileSorter>::New();</div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>sorter->SetInputFileNames(file<wbr></wbr>names);</div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>sorter->Update();</div><div><br></div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>// Get number of series </div><div><span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>int numSeries = sorter->GetNumberOfSeries();<span class="m_-8003454190795948419gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>//==> here I expect to get 2, but only 1 got</div><div>==============================<wbr></wbr>==========================</div><div><br></div><div>actually "A_10_0001_0325.dcm" should be seperate into another series, will any body help me out?</div><div>thanks in advance</div><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:arial"></div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br></div>
</blockquote></div></div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span>