<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><div style="font-size:12.8px"> vtkSmartPointer<<wbr>vtkDICOMReader> reader = vtkSmartPointer<<wbr>vtkDICOMReader>::New();</div><div style="font-size:12.8px"> reader->SetFileNames(fileArray);</div><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><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(<wbr>stacks->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->GetNumberOfValues(); fileNumber++)</div><div style="font-size:12.8px"> {</div><div style="font-size:12.8px"> std::cout << fileArray->GetValue(filesInStack->GetValue(jj)).c_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><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> - David</div><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>i);</div><div><br></div><div><br></div><div>Best Regards</div><div>James</div><div><div class="gmail-m_3545564098429442224h5"><br><br><br><br><div style="zoom:1"></div><div id="gmail-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="gmail-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>> reader = vtkSmartPointer<vtkDICOMReader<wbr>>::New();</div></div><div> reader->SetFileNames(sorter->G<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>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>==========================</div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkStringArray<wbr>> filenames = vtkSmartPointer<vtkStringArray<wbr>>::New();</div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0325.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0326.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0327.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0328.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0329.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0330.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0331.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0332.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0333.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0334.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>filenames->InsertNextValue("A_<wbr>10_0001_0335.dcm"); </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>vtkSmartPointer <vtkDICOMFileSorter> sorter = vtkSmartPointer <vtkDICOMFileSorter>::New();</div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>sorter->SetInputFileNames(file<wbr>names);</div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>sorter->Update();</div><div><br></div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>// Get number of series </div><div><span class="gmail-m_3545564098429442224m_-3428552199300000184m_3053382591066298988Apple-tab-span" style="white-space:pre-wrap"> </span>int numSeries = sorter->GetNumberOfSeries();<span class="gmail-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>==========================</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>