Skip to content

Commit

Permalink
Set again test
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Aug 15, 2023
1 parent c247079 commit ec11e42
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/org/dcm4che3/img/TranscoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,34 @@ void dcm2dcmResize() throws Exception {
Assertions.assertEquals(128, images.get(0).height(), "The height of image doesn't match");
}


@Test
void dcm2dcm_TranscodeMultipleTimes() throws Exception {
test("MR-JPEGLosslessSV1.dcm", UID.JPEGLSLossless, UID.JPEGLosslessSV1);
test("CT-JPEGLosslessSV1.dcm", UID.ExplicitVRLittleEndian, UID.JPEGLSLossless, UID.JPEGLosslessSV1);
}

void test(String srcFileName, String... transferSyntaxList) throws Exception {
String newSrcFileName = null;

for (int i = 0; i < transferSyntaxList.length; i++) {
String transferSyntax = transferSyntaxList[i];
String dstFileName = transferSyntax + ".dcm";
DicomTranscodeParam params = new DicomTranscodeParam(transferSyntax);
Map<ImageContentHash, Consumer<Double>> enumMap = new EnumMap<>(ImageContentHash.class);

if (i == 0) {
Path artifact = transcodeDicom(srcFileName, params, enumMap);
Path target = FileSystems.getDefault().getPath(IN_DIR.toString(), dstFileName);
Files.copy(artifact, target, StandardCopyOption.REPLACE_EXISTING);
} else {
transcodeDicom(newSrcFileName, params, enumMap);
}

newSrcFileName = dstFileName;
}
}

@ParameterizedTest
@EnumSource(Format.class)
@DisplayName("Export YBR_422 DICOM to all the image formats")
Expand Down

0 comments on commit ec11e42

Please sign in to comment.