* @throws Exception
*/
public void testCreateFromPath() throws Exception {
// Read the study.
File testStudy = new File(TESTDIR);
Study s = Study.createFromPath(testStudy);
// Make sure the study stored the correct source directory.
assertEquals(testStudy, s.getSourceDirectory());
// Make sure the study read the correct numbers of objects.
assertEquals(NUM_IMAGES, s.getImages().size());
assertEquals(NUM_SERIES, s.getSeries().size());
assertEquals(NUM_SCOUTS, s.getScouts().size());
assertEquals(NUM_SR, s.getStructuredReports().size());
// Make sure that the presentation states were read in properly.
int psTotal = 0;
for (DICOMImage di : s.getScouts()) {
psTotal += di.getPresentationStates().size();
}
// TODO Ask Craig if the overall image list should include scouts.
for (DICOMImage di : s.getImages()) {
psTotal += di.getPresentationStates().size();
}
assertEquals(NUM_PS, psTotal);
// Make sure that the images were properly distributed into their
// series. We can assume a specific order here, because the study
// reading process sorts the datasets in a deterministic fashion.
int i = 0;
for (Series series : s.getSeries()) {
assertEquals(SERIES_NUMBERS[i], series.getSeriesNumber());
assertEquals(SERIES_COUNTS[i], series.getImages().size());
i++;
}