Package org.dcm4che3.net

Examples of org.dcm4che3.net.ApplicationEntity


        try {
            CommandLine cl = parseComandLine(args);
            Device device = new Device("mppsscu");
            Connection conn = new Connection();
            device.addConnection(conn);
            ApplicationEntity ae = new ApplicationEntity("MPPSSCU");
            device.addApplicationEntity(ae);
            ae.addConnection(conn);
            final MppsSCU main = new MppsSCU(ae);
            configureMPPS(main, cl);
            CLIUtils.configureConnect(main.remote, main.rq, cl);
            CLIUtils.configureBind(conn, main.ae, cl);
            CLIUtils.configure(conn, cl);
View Full Code Here


            LOG.error("Missing broadcast AETitle");
            throw new IllegalAccessException("missing broadcast AETitle");
        }
        Connection conn = new Connection();
        device.addConnection(conn);
        ApplicationEntity ae = new ApplicationEntity(cl.getOptionValue("b")
                .toUpperCase());
        if (cl.hasOption("d")) {
            instance.setDestinationAET(cl.getOptionValue("d"));
        }
        if (cl.hasOption("s")) {
            instance.setSourceAET(cl.getOptionValue("s"));
           
        }
        device.addApplicationEntity(ae);
        ae.addConnection(conn);

        instance.destination = new Connection();

        configureConnect(instance.destination, instance.rq, cl, ae);
        CLIUtils.configure(conn, cl);
        // instance.sourceAE = new
        // ApplicationEntity(cl.getOptionValue("s").split(":")[0]);

        // here load the TCs

            if (cl.hasOption("ldap")) {
                try {
                    InputStream is = null;
                    Properties p = new Properties();
                    if (!cl.getOptionValue("ldap").isEmpty()) {
                        is = new FileInputStream(new File(
                                cl.getOptionValue("ldap")));
                    } else {
                        LOG.error("Missing ldap properties file");
                        throw new IllegalAccessException("missing ldap properties file");
                    }
                    p.load(is);
                    LdapDicomConfiguration conf = new LdapDicomConfiguration(p);
                    LOG.info("Started Loading LDAP configuration");
                    ArrayList<TransferCapability> tcs = null;
                    if(cl.hasOption("s")){
                    ApplicationEntity sourceAE = conf
                            .findApplicationEntity(instance.sourceAET);
                    tcs = (ArrayList<TransferCapability>) sourceAE
                            .getTransferCapabilities();
                    }
                    else
                    {
                        tcs = loadTCFile();
                    }
                    ArrayList<PresentationContext> pcs = addChunkedPCsandSend(
                            ae, device, instance, tcs);
                    // print accepted ones
                    ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
                    for (PresentationContext pc : pcs)
                        if (pc.isAccepted())
                            acceptedPCs.add(pc);

                    LOG.info("Probed the source ae and found the following accepted presentation contexts");
                    for (PresentationContext pc : acceptedPCs) {
                        LOG.info("PC[" + pc.getPCID() + "]\tAbstractSyntax:"
                                + pc.getAbstractSyntax() + "\n with "
                                + " the following Transfer-Syntax:["
                                + pc.getTransferSyntax() + "]");

                    }
                    LOG.info("finished probing TCs");
                    if(instance.destinationAET!=null){
                    LOG.info("Adding Accepted TCs to configuration backend");
                    ApplicationEntity destinationAE = conf
                            .findApplicationEntity(instance.destinationAET);
                   
                    Device toStore = destinationAE.getDevice();
                    TransferCapability[] TCs = mergeTCs(acceptedPCs);
                    for (TransferCapability tc : TCs)
                        toStore.getApplicationEntity(instance.destinationAET)
                                .addTransferCapability(tc);

                    conf.merge(toStore);
                    logAddedTCs(TCs, destinationAE);
                    conf.close();
                    }
                    System.exit(1);
                } catch (ConfigurationException e) {
                    LOG.error("Configuration backend error - {}", e);
                }
            } else if (cl.hasOption("prefs")) {
                // prefs
                try {
                    PreferencesDicomConfiguration conf = new PreferencesDicomConfiguration();
                    LOG.info("Started Loading LDAP configuration");
                    ArrayList<TransferCapability> tcs = null;
                    if(cl.hasOption("s")){
                    ApplicationEntity sourceAE = conf
                            .findApplicationEntity(instance.sourceAET);
                    tcs = (ArrayList<TransferCapability>) sourceAE
                            .getTransferCapabilities();
                    }
                    else
                    {
                        tcs = loadTCFile();
                    }
                    ArrayList<PresentationContext> pcs = addChunkedPCsandSend(
                            ae, device, instance, tcs);
                    // print accepted ones
                    ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
                    for (PresentationContext pc : pcs)
                        if (pc.isAccepted())
                            acceptedPCs.add(pc);

                    LOG.info("Probed the source ae and found the following accepted presentation contexts");
                    for (PresentationContext pc : acceptedPCs) {
                        LOG.info("PC[" + pc.getPCID() + "]\tAbstractSyntax:"
                                + pc.getAbstractSyntax() + "\n with "
                                + " the following Transfer-Syntax:["
                                + pc.getTransferSyntax() + "]");

                    }
                    LOG.info("finished probing TCs");
                    if(instance.destinationAET!=null){
                    LOG.info("Adding Accepted TCs to configuration backend");
                    ApplicationEntity destinationAE = conf
                            .findApplicationEntity(instance.destinationAET);
                   
                    Device toStore = destinationAE.getDevice();
                    TransferCapability[] TCs = mergeTCs(acceptedPCs);
                    for (TransferCapability tc : TCs)
                        toStore.getApplicationEntity(instance.destinationAET)
                                .addTransferCapability(tc);
View Full Code Here

        int port = Integer.parseInt(tmpOption.split("@")[1].split(":")[1]);
        probedAET = aeTitle;
        conn.setHostname(host);
        conn.setPort(port);
        conn.setInstalled(true);
        ae = new ApplicationEntity(aeTitle);
        ae.addConnection(conn);
    }
View Full Code Here


    };

    public GetSCU() throws IOException {
        ae = new ApplicationEntity("GETSCU");
        device.addConnection(conn);
        device.addApplicationEntity(ae);
        ae.addConnection(conn);
        device.setDimseRQHandler(createServiceRegistry());
    }
View Full Code Here

            if(cl.getArgList().isEmpty())
                throw new MissingOptionException(
                        rb.getString("missing-i-file"));
            final Device device = new Device("modality");
            final Connection conn = new Connection();
            final ApplicationEntity ae = new ApplicationEntity("MODALITY");
            checkOptions(cl);
            CLIUtils.configureBind(conn, ae, cl);
            CLIUtils.configure(conn, cl);
            device.addConnection(conn);
            device.addApplicationEntity(ae);
            ae.addConnection(conn);
            final MppsSCU mppsscu = new MppsSCU(ae);
            final StoreSCU storescu = new StoreSCU(ae);
            final StgCmtSCU stgcmtscu = new StgCmtSCU(ae);
            CLIUtils.configureConnect(mppsscu.getRemoteConnection(), mppsscu.getAAssociateRQ(), cl);
            CLIUtils.configureConnect(stgcmtscu.getRemoteConnection(), stgcmtscu.getAAssociateRQ(), cl);
View Full Code Here

        try {
            config.removeDevice("Test-Device-1");
        catch (ConfigurationNotFoundException e) {}
        Device device = createDevice("Test-Device-1", "TEST-AET1");
        config.persist(device);
        ApplicationEntity ae = config.findApplicationEntity("TEST-AET1");
        assertFalse(ae.isAssociationInitiator());
        assertTrue(ae.isAssociationAcceptor());
        assertTrue(ae.getConnections().get(0).isServer());
        TransferCapability echoSCP = ae.getTransferCapabilityFor(
                UID.VerificationSOPClass, TransferCapability.Role.SCP);
        assertNotNull(echoSCP);
        assertArrayEquals(new String[] { UID.ImplicitVRLittleEndian }, echoSCP.getTransferSyntaxes());
        TransferCapability ctSCP = ae.getTransferCapabilityFor(
                UID.CTImageStorage, TransferCapability.Role.SCP);
        assertNotNull(ctSCP);
        assertArrayEquals(new String[] { UID.ImplicitVRLittleEndian, UID.ExplicitVRLittleEndian },
                sort(ctSCP.getTransferSyntaxes()));
        assertNull(ctSCP.getStorageOptions());
        TransferCapability findSCP = ae.getTransferCapabilityFor(
                UID.StudyRootQueryRetrieveInformationModelFIND, TransferCapability.Role.SCP);
        assertNotNull(findSCP);
        assertArrayEquals(new String[] { UID.ImplicitVRLittleEndian }, findSCP.getTransferSyntaxes());
        assertEquals(EnumSet.of(QueryOption.RELATIONAL), findSCP.getQueryOptions());
        assertEquals(1, config.listDeviceInfos(deviceInfo("Test-Device-1")).length);
View Full Code Here

        catch (ConfigurationNotFoundException e) {}
        Device device = createDevice("Test-Device-1", "TEST-AET1");
        config.persist(device);
        modifyDevice(device);
        config.merge(device);
        ApplicationEntity ae2 = config.findApplicationEntity("TEST-AET2");
        ApplicationEntity ae = ae2.getDevice().getApplicationEntity("TEST-AET1");
        assertTrue(ae.isAssociationInitiator());
        assertFalse(ae.isAssociationAcceptor());
        assertFalse(ae.getConnections().get(0).isServer());
        TransferCapability echoSCP = ae.getTransferCapabilityFor(
                UID.VerificationSOPClass, TransferCapability.Role.SCP);
        assertNull(echoSCP);
        TransferCapability echoSCU = ae.getTransferCapabilityFor(
                UID.VerificationSOPClass, TransferCapability.Role.SCU);
        assertNotNull(echoSCU);
        TransferCapability ctSCP = ae.getTransferCapabilityFor(
                UID.CTImageStorage, TransferCapability.Role.SCP);
        assertEquals(STORAGE_OPTIONS, ctSCP.getStorageOptions());
        TransferCapability findSCP = ae.getTransferCapabilityFor(
                UID.StudyRootQueryRetrieveInformationModelFIND, TransferCapability.Role.SCP);
        assertEquals(EnumSet.of(QueryOption.RELATIONAL, QueryOption.DATETIME),
                findSCP.getQueryOptions());
        config.removeDevice("Test-Device-1");
    }
View Full Code Here

    private static Device createDevice(String name, String aet) throws Exception {
        Device device = new Device(name);
        Connection conn = createConn("host.dcm4che.org", 11112);
        device.addConnection(conn);
        ApplicationEntity ae = createAE(aet, conn);
        device.addApplicationEntity(ae);
        return device ;
    }
View Full Code Here

            StorageOptions.LevelOfSupport.LEVEL_2,
            StorageOptions.DigitalSignatureSupport.LEVEL_1,
            StorageOptions.ElementCoercion.YES);

    private static ApplicationEntity createAE(String aet, Connection conn) {
        ApplicationEntity ae = new ApplicationEntity(aet);
        ae.setAssociationInitiator(false);
        ae.addConnection(conn);
        ae.addTransferCapability(echoSCP());
        ae.addTransferCapability(ctSCP());
        ae.addTransferCapability(findSCP());
        return ae;
    }
View Full Code Here

        ae.addTransferCapability(findSCP());
        return ae;
    }

    private static void modifyDevice(Device device) throws Exception  {
        ApplicationEntity ae = device.getApplicationEntity("TEST-AET1");
        ae.getConnections().get(0).setPort(Connection.NOT_LISTENING);
        ae.setAssociationInitiator(true);
        ae.setAssociationAcceptor(false);
        for (TransferCapability tc : ae.getTransferCapabilities()) {
            String sopClass = tc.getSopClass();
            if (sopClass.equals(UID.VerificationSOPClass))
                tc.setRole(TransferCapability.Role.SCU);
            else if (sopClass.equals(UID.CTImageStorage))
                tc.setStorageOptions(STORAGE_OPTIONS);
            else
                tc.getQueryOptions().add(QueryOption.DATETIME);
        }
        Connection conn = createConn("host.dcm4che.org", 11114);
        device.addConnection(conn);
        ApplicationEntity ae2 = createAE("TEST-AET2", conn);
        device.addApplicationEntity(ae2);
    }
View Full Code Here

TOP

Related Classes of org.dcm4che3.net.ApplicationEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.